home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / Emulation_Include_Files / winbase.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  61.2 KB  |  2,974 lines

  1.  
  2. /*++
  3.  
  4. Copyright (c) 1995-1998 Microsoft Corporation
  5.  
  6. Module Name: winbase.h
  7.  
  8. Purpose:This header file declares the Base APIs.
  9.  
  10. --*/
  11.  
  12. #ifndef __WINBASE_H__
  13. #define __WINBASE_H__
  14.  
  15. //
  16. // Define API decoration for direct importing of DLL references.
  17. //
  18.  
  19. #if !defined(_ADVAPI32_)
  20. #ifdef _WIN32_WCE_EMULATION
  21. #define WINADVAPI
  22. #else
  23. #define WINADVAPI  DECLSPEC_IMPORT
  24. #endif
  25. #else
  26.     #define WINADVAPI
  27. #endif
  28.  
  29. #if !defined(COREDLL)
  30. #ifdef _WIN32_WCE_EMULATION
  31. #define WINBASEAPI
  32. #else
  33. #define WINBASEAPI DECLSPEC_IMPORT
  34. #endif
  35. #else
  36. #define WINBASEAPI
  37. #endif
  38.  
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42.  
  43. #include <windef.h>
  44.  
  45. #define INVALID_HANDLE_VALUE (HANDLE)-1
  46. #define INVALID_FILE_SIZE (DWORD)0xFFFFFFFF
  47.  
  48. #define FILE_BEGIN           0
  49. #define FILE_CURRENT         1
  50. #define FILE_END             2
  51. //
  52. //  File System time stamps are represented with the following structure:
  53. //
  54.  
  55. typedef struct _FILETIME {
  56.     DWORD dwLowDateTime;
  57.     DWORD dwHighDateTime;
  58. } FILETIME, *PFILETIME, *LPFILETIME;
  59.  
  60. typedef struct _SYSTEMTIME {
  61.     WORD wYear;
  62.     WORD wMonth;
  63.     WORD wDayOfWeek;
  64.     WORD wDay;
  65.     WORD wHour;
  66.     WORD wMinute;
  67.     WORD wSecond;
  68.     WORD wMilliseconds;
  69. } SYSTEMTIME, *LPSYSTEMTIME;
  70.  
  71. #ifdef MIPS_R4000 /* or above */
  72.  
  73. #define InterlockedIncrement _InterlockedIncrement
  74. #define InterlockedDecrement _InterlockedDecrement
  75. #define InterlockedExchange _InterlockedExchange
  76.  
  77. LONG
  78. WINAPI
  79. InterlockedIncrement(
  80.     LPLONG lpAddend
  81.     );
  82.  
  83. LONG
  84. WINAPI
  85. InterlockedDecrement(
  86.     LPLONG lpAddend
  87.     );
  88.  
  89. LONG
  90. WINAPI
  91. InterlockedExchange(
  92.     LPLONG Target,
  93.     LONG Value
  94.     );
  95.  
  96. #pragma intrinsic(_InterlockedIncrement)
  97. #pragma intrinsic(_InterlockedDecrement)
  98. #pragma intrinsic(_InterlockedExchange)
  99.  
  100. #elif (defined(PPC) && _MSC_VER >= 1000) && !defined(RC_INVOKED)
  101.  
  102. #define InterlockedIncrement _InterlockedIncrement
  103. #define InterlockedDecrement _InterlockedDecrement
  104. #define InterlockedExchange _InterlockedExchange
  105. #define InterlockedExchangeAdd _InterlockedExchangeAdd
  106. #define InterlockedCompareExchange _InterlockedCompareExchange
  107.  
  108. LONG
  109. WINAPI
  110. InterlockedIncrement(
  111.     LPLONG lpAddend
  112.     );
  113.  
  114. LONG
  115. WINAPI
  116. InterlockedDecrement(
  117.     LPLONG lpAddend
  118.     );
  119.  
  120. LONG
  121. WINAPI
  122. InterlockedExchange(
  123.     LPLONG Target,
  124.     LONG Value
  125.     );
  126.  
  127. PVOID
  128. WINAPI
  129. InterlockedCompareExchange (
  130.     PVOID *Destination,
  131.     PVOID Exchange,
  132.     PVOID Comperand
  133.     );
  134.  
  135. LONG
  136. WINAPI
  137. InterlockedExchangeAdd(
  138.     LPLONG Addend,
  139.     LONG Value
  140.     );
  141.  
  142. #define InterlockedTestExchange(Target, oldValue, newValue) \
  143.     ((long)InterlockedCompareExchange((PVOID*)(Target), (PVOID)(newValue), (PVOID)(oldValue)))
  144.  
  145. #pragma intrinsic(_InterlockedIncrement)
  146. #pragma intrinsic(_InterlockedDecrement)
  147. #pragma intrinsic(_InterlockedExchange)
  148. #pragma intrinsic(_InterlockedCompareExchange)
  149. #pragma intrinsic(_InterlockedExchangeAdd)
  150.  
  151. #elif defined(x86) || defined(_X86_)
  152.  
  153. #pragma warning(disable:4035)               // re-enable below
  154.  
  155.   __inline
  156.   LONG
  157.   WINAPI
  158.   InterlockedIncrement(
  159.       IN PLONG Addend
  160.       )
  161.   {
  162.       __asm {
  163.           mov     eax, 1
  164.           mov     ecx, Addend
  165.           xadd    [ecx], eax
  166.           inc     eax
  167.       }
  168.   }
  169.  
  170.   __inline
  171.   LONG
  172.   WINAPI
  173.   InterlockedDecrement(
  174.       IN PLONG Addend
  175.       )
  176.   {
  177.       __asm {
  178.           mov     eax, -1
  179.           mov     ecx, Addend
  180.           xadd    [ecx], eax
  181.           dec     eax
  182.       }
  183.   }
  184.  
  185.   __inline
  186.   LONG
  187.   WINAPI
  188.   InterlockedExchange(
  189.       IN OUT PLONG Target,
  190.       IN LONG Value
  191.       )
  192.   {
  193.       __asm {
  194.           mov     eax, Value
  195.           mov     ecx, Target
  196.           xchg     [ecx], eax
  197.       }
  198.   }
  199.  
  200.  
  201.   __inline
  202.   LONG
  203.   WINAPI
  204.   InterlockedTestExchange(
  205.       LPLONG Target,
  206.       LONG oldValue,
  207.       LONG newValue
  208.       )
  209.   {
  210.       __asm {
  211.           mov     eax, oldValue
  212.           mov     ecx, Target
  213.           mov     edx, newValue
  214.           cmpxchg [ecx], edx
  215.       }
  216.   }
  217.  
  218. #pragma warning(default:4035)
  219.  
  220. #else
  221.  
  222. LONG
  223. WINAPI
  224. InterlockedIncrement(
  225.     LPLONG lpAddend
  226.     );
  227.  
  228.  
  229. LONG
  230. WINAPI
  231. InterlockedDecrement(
  232.     LPLONG lpAddend
  233.     );
  234.  
  235.  
  236. LONG
  237. WINAPI
  238. InterlockedExchange(
  239.     LPLONG Target,
  240.     LONG Value
  241.     );
  242.  
  243. LONG
  244. WINAPI
  245. InterlockedTestExchange(
  246.     LPLONG Target,
  247.     LONG oldValue,
  248.     LONG newValue
  249.     );
  250.  
  251. #endif
  252.  
  253. DWORD
  254. WINAPI
  255. Random();
  256.  
  257.  
  258. int
  259. WINAPI
  260. WinMain(
  261.     HINSTANCE hInstance,
  262.     HINSTANCE hPrevInstance,
  263. #ifdef UNDER_CE
  264.     LPWSTR lpCmdLine,
  265. #else
  266.     LPSTR lpCmdLine,
  267. #endif
  268.     int nShowCmd
  269.     );
  270.  
  271. LONG WINAPI CompareFileTime(const FILETIME *lpft1, const FILETIME *lpft2);
  272. BOOL WINAPI FileTimeToSystemTime(const FILETIME *lpft, LPSYSTEMTIME lpst);
  273. BOOL WINAPI SystemTimeToFileTime(const SYSTEMTIME *lpst, LPFILETIME lpft);
  274. BOOL WINAPI FileTimeToLocalFileTime(const FILETIME *lpft, LPFILETIME lpftLocal);
  275. BOOL WINAPI LocalFileTimeToFileTime(const FILETIME *lpftLocal, LPFILETIME lpft);
  276.  
  277. // Internal API for the file system
  278. #ifdef _WIN32_WCE_EMULATION
  279. VOID WINAPI GetCurrentFT(LPFILETIME lpFileTime);
  280. #else
  281. VOID GetCurrentFT(LPFILETIME lpFileTime);
  282. #endif
  283.  
  284. /* Taken from NT's process.h */
  285. BOOL
  286. WINAPI
  287. DllMain (
  288.     HANDLE hinstDLL,
  289.     DWORD dwReason,
  290.     LPVOID lpvReserved
  291.     );
  292.  
  293. #ifdef UNDER_CE
  294. #define GetProcAddress GetProcAddressW
  295.  
  296. WINBASEAPI
  297. FARPROC
  298. WINAPI
  299. GetProcAddressW(
  300.     HMODULE hModule,
  301.     LPCWSTR lpProcName
  302.     );
  303.  
  304. #else
  305.  
  306. WINBASEAPI
  307. FARPROC
  308. WINAPI
  309. GetProcAddress(
  310.     HMODULE hModule,
  311.     LPCSTR lpProcName
  312.     );
  313.  
  314. #endif
  315.  
  316. VOID
  317. WINAPI
  318. GetLocalTime (
  319.     LPSYSTEMTIME lpSystemTime
  320.     );
  321.  
  322. VOID
  323. WINAPI
  324. GetSystemTime (
  325.     LPSYSTEMTIME lpSystemTime
  326.     );
  327.  
  328. typedef struct _TIME_ZONE_INFORMATION {
  329.     LONG Bias;
  330.     WCHAR StandardName[ 32 ];
  331.     SYSTEMTIME StandardDate;
  332.     LONG StandardBias;
  333.     WCHAR DaylightName[ 32 ];
  334.     SYSTEMTIME DaylightDate;
  335.     LONG DaylightBias;
  336. } TIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION;
  337.  
  338. DWORD
  339. WINAPI
  340. GetTimeZoneInformation (
  341.     LPTIME_ZONE_INFORMATION lpTimeZoneInformation
  342.     );
  343.  
  344. BOOL
  345. WINAPI
  346. SetLocalTime (
  347.     CONST SYSTEMTIME *lpSystemTime
  348.     );
  349.  
  350. BOOL
  351. WINAPI
  352. SetSystemTime (
  353.     CONST SYSTEMTIME *lpSystemTime
  354.     );
  355.  
  356. void
  357. WINAPI
  358. SetDaylightTime (
  359.     DWORD dst
  360.     );
  361.  
  362. BOOL
  363. WINAPI
  364. SetTimeZoneInformation (
  365.     CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation
  366.     );
  367.  
  368. /*
  369.     @doc BOTH EXTERNAL
  370.     
  371.     @func LPTSTR | lstrcat| Appends one string to another.
  372.     @parm LPTSTR | lpszString1 | address of buffer for concatenated strings
  373.     @parm LPTSTR | lpszString2 | address of string to add to string1
  374.  
  375.     @comm Follows the Win32 reference description with these restrictions:
  376.     @comm Supports only the Unicode version of this function.
  377.  
  378. */
  379. WINBASEAPI
  380. LPSTR
  381. WINAPI
  382. lstrcatA(
  383.     LPSTR lpString1,
  384.     LPCSTR lpString2
  385.     );
  386.  
  387. #define lstrcatW wcscat
  388. #ifdef UNICODE
  389. #define lstrcat lstrcatW
  390. #else
  391. #define lstrcat lstrcatA
  392. #endif
  393.  
  394. /*
  395.     @doc BOTH EXTERNAL
  396.     
  397.     @func int | lstrcmp| Compares two character strings. The comparison is case sensitive.
  398.     @parm LPTSTR | lpszString1 | address of first string
  399.     @parm LPTSTR | lpszString2 | address of second string
  400.  
  401.     @comm Follows the Win32 reference description with these restrictions:
  402.     @comm Supports only the Unicode version of this function.
  403.  
  404. */
  405.  
  406. WINBASEAPI
  407. int
  408. WINAPI
  409. lstrcmpA(
  410.     LPCSTR lpString1,
  411.     LPCSTR lpString2
  412.     );
  413. WINBASEAPI
  414. int
  415. WINAPI
  416. lstrcmpW(
  417.     LPCWSTR lpString1,
  418.     LPCWSTR lpString2
  419.     );
  420. #ifdef UNICODE
  421. #define lstrcmp  lstrcmpW
  422. #else
  423. #define lstrcmp  lstrcmpA
  424. #endif // !UNICODE
  425.  
  426. /*
  427.     @doc BOTH EXTERNAL
  428.     
  429.     @func int | lstrcmpi| Compares two character strings. The comparison is
  430.     not case sensitive.
  431.     @parm LPTSTR | lpszString1 | address of first string
  432.     @parm LPTSTR | lpszString2 | address of second string
  433.  
  434.     @comm Follows the Win32 reference description with these restrictions:
  435.     @comm Supports only the Unicode version of this function.
  436.  
  437. */
  438.  
  439. WINBASEAPI
  440. int
  441. WINAPI
  442. lstrcmpiA(
  443.     LPCSTR lpString1,
  444.     LPCSTR lpString2
  445.     );
  446. WINBASEAPI
  447. int
  448. WINAPI
  449. lstrcmpiW(
  450.     LPCWSTR lpString1,
  451.     LPCWSTR lpString2
  452.     );
  453. #ifdef UNICODE
  454. #define lstrcmpi  lstrcmpiW
  455. #else
  456. #define lstrcmpi  lstrcmpiA
  457. #endif // !UNICODE
  458.  
  459. /*
  460.     @doc BOTH EXTERNAL
  461.     
  462.     @func LPTSTR | lstrcpy| Copies a string to a buffer.
  463.     @parm LPTSTR | lpszString1 | address of buffer
  464.     @parm LPTSTR | lpszString2 | address of string to copy
  465.  
  466.     @comm Follows the Win32 reference description with these restrictions:
  467.     @comm Supports only the Unicode version of this function.
  468.  
  469. */
  470. WINBASEAPI
  471. LPSTR
  472. WINAPI
  473. lstrcpyA(
  474.     LPSTR lpString1,
  475.     LPCSTR lpString2
  476.     );
  477. #define lstrcpyW wcscpy
  478. #ifdef UNICODE
  479. #define lstrcpy lstrcpyW
  480. #else
  481. #define lstrcpy lstrcpyA
  482. #endif
  483.  
  484. /*
  485.     @doc BOTH EXTERNAL
  486.     
  487.     @func int | lstrlen| The lstrlen function returns the length, in characters, of
  488.     the specified string (not including the terminating null character).
  489.     @parm LPTSTR | lpszString | address of string to count
  490.  
  491.     @comm Follows the Win32 reference description with these restrictions:
  492.     @comm Supports only the Unicode version of this function.
  493.  
  494. */
  495. WINBASEAPI
  496. int
  497. WINAPI
  498. lstrlenA(
  499.     LPCSTR lpString
  500.     );
  501. #define lstrlenW wcslen
  502. #ifdef UNICODE
  503. #define lstrlen lstrlenW
  504. #else
  505. #define lstrlen lstrlenA
  506. #endif
  507.  
  508. DWORD
  509. WINAPI
  510. CharLowerBuffA (
  511.     LPSTR lpsz,
  512.     DWORD cchLength
  513.     );
  514. DWORD
  515. WINAPI
  516. CharLowerBuffW (
  517.     LPWSTR lpsz,
  518.     DWORD cchLength
  519.     );
  520. #ifdef UNICODE
  521. #define CharLowerBuff CharLowerBuffW
  522. #else
  523. #define CharLowerBuff CharLowerBuffA
  524. #endif
  525.  
  526. DWORD
  527. WINAPI
  528. CharUpperBuffA (
  529.     LPSTR lpsz,
  530.     DWORD cchLength
  531.     );
  532. DWORD
  533. WINAPI
  534. CharUpperBuffW (
  535.     LPWSTR lpsz,
  536.     DWORD cchLength
  537.     );
  538. #ifdef UNICODE
  539. #define CharUpperBuff CharUpperBuffW
  540. #else
  541. #define CharUpperBuff CharUpperBuffA
  542. #endif
  543.  
  544. LPSTR WINAPI CharLowerA(LPSTR lpsz);
  545. LPWSTR WINAPI CharLowerW(LPWSTR lpsz);
  546.  
  547. #ifdef UNICODE
  548. #define CharLower CharLowerW
  549. #else
  550. #define CharLower CharLowerA
  551. #endif
  552.  
  553. LPSTR WINAPI CharUpperA(LPSTR lpsz);
  554. LPWSTR WINAPI CharUpperW(LPWSTR lpsz);
  555.  
  556. #ifdef UNICODE
  557. #define CharUpper CharUpperW
  558. #else
  559. #define CharUpper CharUpperA
  560. #endif
  561.  
  562. LPSTR
  563. WINAPI
  564. CharPrevA(
  565.     LPCSTR lpszStart,
  566.     LPCSTR lpszCurrent);
  567.  
  568. LPWSTR
  569. WINAPI
  570. CharPrevW(
  571.     LPCWSTR lpszStart,
  572.     LPCWSTR lpszCurrent);
  573.  
  574. #ifdef UNICODE
  575. #define CharPrev  CharPrevW
  576. #else
  577. #define CharPrev  CharPrevA
  578. #endif // !UNICODE
  579.  
  580. LPSTR
  581. WINAPI
  582. CharNextA(
  583.     LPCSTR lpsz);
  584.  
  585. LPWSTR
  586. WINAPI
  587. CharNextW(
  588.     LPCWSTR lpsz);
  589.  
  590. #ifdef UNICODE
  591. #define CharNext  CharNextW
  592. #else
  593. #define CharNext  CharNextA
  594. #endif // !UNICODE
  595.  
  596.  
  597.  
  598. /*
  599.     @doc BOTH EXTERNAL
  600.     
  601.     @func BOOL | IsCharAlpha| Determines whether a character is an alphabetic character.
  602.     @parm TCHAR | ch | character to test
  603.  
  604.     @comm Follows the Win32 reference description without restrictions or modifications.
  605. */
  606.  
  607. #define IsCharAlphaA isalpha
  608. #define IsCharAlphaW iswalpha
  609. #ifdef UNICODE
  610. #define IsCharAlpha IsCharAlphaW
  611. #else
  612. #define IsCharAlpha IsCharAlphaA
  613. #endif
  614.  
  615.  
  616. /*
  617.     @doc BOTH EXTERNAL
  618.     
  619.     @func BOOL | IsCharAlphaNumericW| Determines whether a character is either an
  620.     alphabetic or a numeric character.
  621.  
  622.     @comm Follows the Win32 reference description without restrictions or modifications.
  623. */
  624.  
  625. #define IsCharAlphaNumericA isalnum
  626. #define IsCharAlphaNumericW iswalnum
  627. #ifdef UNICODE
  628. #define IsCharAlphaNumeric IsCharAlphaNumericW
  629. #else
  630. #define IsCharAlphaNumeric IsCharAlphaNumericA
  631. #endif
  632.  
  633. /*
  634.     @doc BOTH EXTERNAL
  635.     
  636.     @func BOOL | IsCharLower | Determines whether a character is lowercase.
  637.     @parm TCHAR | ch | character to test
  638.  
  639.     @comm Follows the Win32 reference description with these restrictions:
  640.     @comm Supports only the Unicode version of this function.
  641. */
  642.  
  643. #define IsCharLowerA islower
  644. #define IsCharLowerW iswlower
  645. #ifdef UNICODE
  646. #define IsCharLower IsCharLowerW
  647. #else
  648. #define IsCharLower IsCharLowerA
  649. #endif
  650.  
  651. /*
  652.     @doc BOTH EXTERNAL
  653.     
  654.     @func BOOL | IsCharUpper | Determines whether a character is uppercase.
  655.     @parm TCHAR | ch | character to test
  656.  
  657.     @comm Follows the Win32 reference description with these restrictions:
  658.     @comm Supports only the Unicode version of this function.
  659. */
  660.  
  661. #define IsCharUpperA isupper
  662. #define IsCharUpperW iswupper
  663. #ifdef UNICODE
  664. #define IsCharUpper IsCharUpperW
  665. #else
  666. #define IsCharUpper IsCharUpperA
  667. #endif
  668.  
  669. #include <stdarg.h>
  670.  
  671. int
  672. WINAPIV
  673. wsprintfA (
  674.     LPSTR lpBuffer,
  675.     LPCSTR lpFormat,
  676.     ...
  677.     );
  678. int
  679. WINAPIV
  680. wsprintfW (
  681.     LPWSTR lpBuffer,
  682.     LPCWSTR lpFormat,
  683.     ...
  684.     );
  685.  
  686. #ifdef UNICODE
  687. #define wsprintf wsprintfW
  688. #else
  689. #define wsprintf wsprintfA
  690. #endif
  691.  
  692. #ifdef COREDLL
  693. // need STDLIB.H for this to work
  694. #define wsprintfW  swprintf
  695. #define wvsprintfW vswprintf
  696. #endif
  697.  
  698. #ifdef _WIN32_WCE_EMULATION
  699. int
  700. __cdecl
  701. wvsprintfA (
  702.     LPSTR,
  703.     LPCSTR,
  704.     va_list ArgList
  705.     );
  706.  
  707. int
  708. __cdecl
  709. wvsprintfW (
  710.     LPWSTR,
  711.     LPCWSTR,
  712.     va_list ArgList
  713.     );
  714. #else
  715. int
  716. WINAPI
  717. wvsprintfA (
  718.     LPSTR,
  719.     LPCSTR,
  720.     va_list ArgList
  721.     );
  722.  
  723. int
  724. WINAPI
  725. wvsprintfW (
  726.     LPWSTR,
  727.     LPCWSTR,
  728.     va_list ArgList
  729.     );
  730. #endif
  731. #ifdef UNICODE
  732. #define wvsprintf wvsprintfW
  733. #else
  734. #define wvsprintf wvsprintfA
  735. #endif
  736.  
  737. // @CESYSGEN IF COREDLL_LMEM
  738.  
  739. /* Why does Win32 not use the LSB flag ? */
  740. #define LMEM_FIXED          0x0000
  741. #define LMEM_MOVEABLE       0x0002
  742. #define LMEM_NOCOMPACT      0x0010       /**** Used for Moveable Memory  ***/
  743. #define LMEM_NODISCARD      0x0020       /**** Ignored *****/
  744. #define LMEM_ZEROINIT       0x0040
  745. #define LMEM_MODIFY         0x0080       /*** Used only in LocalReAlloc() **/
  746. #define LMEM_DISCARDABLE    0x0F00       /**** Ignored ****/
  747. #define LMEM_VALID_FLAGS    0x0F72
  748. #define LMEM_INVALID_HANDLE 0x8000
  749.  
  750. #define LHND                (LMEM_MOVEABLE | LMEM_ZEROINIT)
  751. #define LPTR                (LMEM_FIXED | LMEM_ZEROINIT)
  752.  
  753. #define NONZEROLHND         (LMEM_MOVEABLE)
  754. #define NONZEROLPTR         (LMEM_FIXED)
  755.  
  756. /* Flags returned by LocalFlags (in addition to LMEM_DISCARDABLE) */
  757. #define LMEM_DISCARDED      0x4000
  758. #define LMEM_LOCKCOUNT      0x00FF
  759.  
  760. // @CESYSGEN ENDIF
  761.  
  762. typedef struct _MEMORYSTATUS {
  763.     DWORD dwLength;
  764.     DWORD dwMemoryLoad;
  765.     DWORD dwTotalPhys;
  766.     DWORD dwAvailPhys;
  767.     DWORD dwTotalPageFile;
  768.     DWORD dwAvailPageFile;
  769.     DWORD dwTotalVirtual;
  770.     DWORD dwAvailVirtual;
  771. } MEMORYSTATUS, *LPMEMORYSTATUS;
  772.  
  773. VOID
  774. WINAPI
  775. GlobalMemoryStatus(
  776.     LPMEMORYSTATUS lpBuffer
  777.     );
  778.  
  779. // @CESYSGEN IF COREDLL_LMEM
  780.  
  781. #ifdef UNDER_CE
  782. #define LocalLock(X) ((LPVOID)(X))
  783. #define LocalUnlock(X) (0)
  784. #define LocalHandle(X) ((HLOCAL)(X))
  785. #define LocalFlags(X) (0)
  786. #else
  787. WINBASEAPI
  788. LPVOID
  789. WINAPI
  790. LocalLock(
  791.     HLOCAL hMem
  792.     );
  793.  
  794. WINBASEAPI
  795. BOOL
  796. WINAPI
  797. LocalUnlock(
  798.     HLOCAL hMem
  799.     );
  800.  
  801. WINBASEAPI
  802. HLOCAL
  803. WINAPI
  804. LocalHandle(
  805.     LPCVOID pMem
  806.     );
  807.  
  808. WINBASEAPI
  809. UINT
  810. WINAPI
  811. LocalFlags(
  812.     HLOCAL hMem
  813.     );
  814. #endif
  815.  
  816. HLOCAL
  817. WINAPI
  818. LocalAlloc (
  819.     UINT fuFlags,
  820.     UINT cbBytes
  821.     );
  822.  
  823. HLOCAL
  824. WINAPI
  825. LocalFree (
  826.     HLOCAL hMem
  827.     );
  828.  
  829. HLOCAL
  830. WINAPI
  831. LocalReAlloc (
  832.     HLOCAL hMem,
  833.     UINT cbBytes,
  834.     UINT fuFlags
  835.     );
  836.  
  837. UINT
  838. WINAPI
  839. LocalSize (
  840.     HLOCAL hMem
  841.     );
  842.  
  843. // @CESYSGEN ENDIF
  844.  
  845. LPVOID
  846. WINAPI
  847. VirtualAlloc(
  848.     LPVOID lpAddress,
  849.     DWORD dwSize,
  850.     DWORD flAllocationType,
  851.     DWORD flProtect
  852.     );
  853.  
  854. BOOL
  855. WINAPI
  856. VirtualFree(
  857.     LPVOID lpAddress,
  858.     DWORD dwSize,
  859.     DWORD dwFreeType
  860.     );
  861.  
  862. BOOL
  863. WINAPI
  864. VirtualProtect(
  865.     LPVOID lpAddress,
  866.     DWORD dwSize,
  867.     DWORD flNewProtect,
  868.     PDWORD lpflOldProtect
  869.     );
  870.  
  871. DWORD
  872. WINAPI
  873. VirtualQuery(
  874.     LPCVOID lpAddress,
  875.     PMEMORY_BASIC_INFORMATION lpBuffer,
  876.     DWORD dwLength
  877.     );
  878.  
  879. #ifdef _WIN32_WCE_EMULATION
  880. void WINAPI ThisIsGwes(void);
  881. #else
  882. void ThisIsGwes(void);
  883. #endif
  884.  
  885. // @CESYSGEN IF COREDLL_LMEM
  886.  
  887. HANDLE WINAPI GetProcessHeap(VOID);
  888.  
  889. HANDLE
  890. WINAPI
  891. HeapCreate(
  892.     DWORD flOptions,
  893.     DWORD dwInitialSize,
  894.     DWORD dwMaximumSize
  895.     );
  896.  
  897. BOOL
  898. WINAPI
  899. HeapDestroy(
  900.     HANDLE hHeap
  901.     );
  902.  
  903. LPVOID
  904. WINAPI
  905. HeapAlloc(
  906.     HANDLE hHeap,
  907.     DWORD dwFlags,
  908.     DWORD dwBytes
  909.     );
  910.  
  911. LPVOID
  912. WINAPI
  913. HeapReAlloc(
  914.     HANDLE hHeap,
  915.     DWORD dwFlags,
  916.     LPVOID lpMem,
  917.     DWORD dwBytes
  918.     );
  919.  
  920. BOOL
  921. WINAPI
  922. HeapFree(
  923.     HANDLE hHeap,
  924.     DWORD dwFlags,
  925.     LPVOID lpMem
  926.     );
  927.  
  928. DWORD
  929. WINAPI
  930. HeapSize(
  931.     HANDLE hHeap,
  932.     DWORD dwFlags,
  933.     LPCVOID lpMem
  934.     );
  935.  
  936. BOOL
  937. WINAPI
  938. HeapValidate(
  939.     HANDLE hHeap,
  940.     DWORD dwFlags,
  941.     LPCVOID lpMem
  942.     );
  943.  
  944. // @CESYSGEN ENDIF
  945.  
  946. VOID
  947. WINAPI
  948. OutputDebugStringA(
  949.     LPCSTR lpOutputString
  950.     );
  951.  
  952. VOID
  953. WINAPI
  954. OutputDebugStringW(
  955.     LPCWSTR lpOutputString
  956.     );
  957. #ifdef UNICODE
  958. #define OutputDebugString  OutputDebugStringW
  959. #else
  960. #define OutputDebugString  OutputDebugStringA
  961. #endif // !UNICODE
  962.  
  963. #ifndef UNDER_CE
  964. WINBASEAPI
  965. VOID
  966. WINAPI
  967. DebugBreak(
  968.     VOID
  969.     );
  970. #endif
  971.  
  972. #ifdef _WIN32_WCE_EMULATION
  973. VOID WINAPI SignalStarted(DWORD dw);
  974. #else
  975. VOID SignalStarted(DWORD dw);
  976. #endif
  977.  
  978. BOOL
  979. WINAPI
  980. QueryPerformanceCounter(
  981.     LARGE_INTEGER *lpPerformanceCount
  982.     );
  983.  
  984. BOOL
  985. WINAPI
  986. QueryPerformanceFrequency(
  987.     LARGE_INTEGER *lpFrequency
  988.     );
  989.  
  990. #define VER_PLATFORM_WIN32s             0
  991. #define VER_PLATFORM_WIN32_WINDOWS      1
  992. #define VER_PLATFORM_WIN32_NT           2
  993. #define VER_PLATFORM_WIN32_HH           3
  994. #define VER_PLATFORM_WIN32_CE           3
  995.  
  996. typedef struct _OSVERSIONINFOA {
  997.     DWORD dwOSVersionInfoSize;
  998.     DWORD dwMajorVersion;
  999.     DWORD dwMinorVersion;
  1000.     DWORD dwBuildNumber;
  1001.     DWORD dwPlatformId;
  1002.     CHAR   szCSDVersion[ 128 ];       // Maintenance string for PSS usage
  1003. } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
  1004. typedef struct _OSVERSIONINFOW {
  1005.     DWORD dwOSVersionInfoSize;
  1006.     DWORD dwMajorVersion;
  1007.     DWORD dwMinorVersion;
  1008.     DWORD dwBuildNumber;
  1009.     DWORD dwPlatformId;
  1010.     WCHAR  szCSDVersion[ 128 ];       // Maintenance string for PSS usage
  1011. } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW;
  1012. #ifdef UNICODE
  1013. typedef OSVERSIONINFOW OSVERSIONINFO;
  1014. typedef POSVERSIONINFOW POSVERSIONINFO;
  1015. typedef LPOSVERSIONINFOW LPOSVERSIONINFO;
  1016. #else
  1017. typedef OSVERSIONINFOA OSVERSIONINFO;
  1018. typedef POSVERSIONINFOA POSVERSIONINFO;
  1019. typedef LPOSVERSIONINFOA LPOSVERSIONINFO;
  1020. #endif // UNICODE
  1021.  
  1022. BOOL
  1023. WINAPI
  1024. GetVersionExA(
  1025.     LPOSVERSIONINFOA lpVersionInformation
  1026.     );
  1027. BOOL
  1028. WINAPI
  1029. GetVersionExW(
  1030.     LPOSVERSIONINFOW lpVersionInformation
  1031.     );
  1032. #ifdef UNICODE
  1033. #define GetVersionEx  GetVersionExW
  1034. #else
  1035. #define GetVersionEx  GetVersionExA
  1036. #endif // !UNICODE
  1037.  
  1038. typedef struct _SYSTEM_INFO {
  1039.     union {
  1040.         DWORD dwOemId;          // Obsolete field...do not use
  1041.         struct {
  1042.             WORD wProcessorArchitecture;
  1043.             WORD wReserved;
  1044.         };
  1045.     };
  1046.     DWORD dwPageSize;
  1047.     LPVOID lpMinimumApplicationAddress;
  1048.     LPVOID lpMaximumApplicationAddress;
  1049.     DWORD dwActiveProcessorMask;
  1050.     DWORD dwNumberOfProcessors;
  1051.     DWORD dwProcessorType;
  1052.     DWORD dwAllocationGranularity;
  1053.     WORD wProcessorLevel;
  1054.     WORD wProcessorRevision;
  1055. } SYSTEM_INFO, *LPSYSTEM_INFO;
  1056.  
  1057. HINSTANCE
  1058. WINAPI
  1059. LoadLibraryA(
  1060.     LPCSTR lpLibFileName
  1061.     );
  1062.  
  1063. HINSTANCE
  1064. WINAPI
  1065. LoadLibraryW(
  1066.     LPCWSTR lpLibFileName
  1067.     );
  1068. #ifdef UNICODE
  1069. #define LoadLibrary  LoadLibraryW
  1070. #else
  1071. #define LoadLibrary  LoadLibraryA
  1072. #endif // !UNICODE
  1073.  
  1074. WINBASEAPI
  1075. DWORD
  1076. WINAPI
  1077. GetModuleFileNameA(
  1078.     HMODULE hModule,
  1079.     LPSTR lpFilename,
  1080.     DWORD nSize
  1081.     );
  1082. WINBASEAPI
  1083. DWORD
  1084. WINAPI
  1085. GetModuleFileNameW(
  1086.     HMODULE hModule,
  1087.     LPWSTR lpFilename,
  1088.     DWORD nSize
  1089.     );
  1090. #ifdef UNICODE
  1091. #define GetModuleFileName  GetModuleFileNameW
  1092. #else
  1093. #define GetModuleFileName  GetModuleFileNameA
  1094. #endif // !UNICODE
  1095.  
  1096. WINBASEAPI
  1097. HMODULE
  1098. WINAPI
  1099. GetModuleHandleA(
  1100.     LPCSTR lpModuleName
  1101.     );
  1102. WINBASEAPI
  1103. HMODULE
  1104. WINAPI
  1105. GetModuleHandleW(
  1106.     LPCWSTR lpModuleName
  1107.     );
  1108. #ifdef UNICODE
  1109. #define GetModuleHandle  GetModuleHandleW
  1110. #else
  1111. #define GetModuleHandle  GetModuleHandleA
  1112. #endif // !UNICODE
  1113.  
  1114. #define PAGE_NOACCESS          0x01
  1115. #define PAGE_READONLY          0x02
  1116. #define PAGE_READWRITE         0x04
  1117. #define PAGE_WRITECOPY         0x08
  1118. #define PAGE_EXECUTE           0x10
  1119. #define PAGE_EXECUTE_READ      0x20
  1120. #define PAGE_EXECUTE_READWRITE 0x40
  1121. #define PAGE_EXECUTE_WRITECOPY 0x80
  1122. #define PAGE_GUARD            0x100
  1123. #define PAGE_NOCACHE          0x200
  1124. #define MEM_COMMIT           0x1000
  1125. #define MEM_RESERVE          0x2000
  1126. #define MEM_DECOMMIT         0x4000
  1127. #define MEM_RELEASE          0x8000
  1128. #define MEM_FREE            0x10000
  1129. #define MEM_PRIVATE         0x20000
  1130. #define MEM_MAPPED          0x40000
  1131. #define MEM_TOP_DOWN       0x100000
  1132. #define MEM_AUTO_COMMIT    0x200000
  1133.  
  1134. //
  1135. //  File structures
  1136. //
  1137.  
  1138. typedef struct _OVERLAPPED {
  1139.     DWORD   Internal;
  1140.     DWORD   InternalHigh;
  1141.     DWORD   Offset;
  1142.     DWORD   OffsetHigh;
  1143.     HANDLE  hEvent;
  1144. } OVERLAPPED, *LPOVERLAPPED;
  1145.  
  1146. typedef struct _SECURITY_ATTRIBUTES {
  1147.     DWORD nLength;
  1148.     LPVOID lpSecurityDescriptor;
  1149.     BOOL bInheritHandle;
  1150. } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
  1151.  
  1152. typedef DWORD (WINAPI *LPTHREAD_START_ROUTINE)(LPVOID pvarg);
  1153.  
  1154. typedef LPTHREAD_START_ROUTINE PTHREAD_START_ROUTINE;
  1155.  
  1156. #define DEBUG_PROCESS               0x00000001
  1157. #define DEBUG_ONLY_THIS_PROCESS     0x00000002
  1158.  
  1159. #define THREAD_PRIORITY_TIME_CRITICAL   0
  1160. #define THREAD_PRIORITY_HIGHEST         1
  1161. #define THREAD_PRIORITY_ABOVE_NORMAL    2
  1162. #define THREAD_PRIORITY_NORMAL          3
  1163. #define THREAD_PRIORITY_BELOW_NORMAL    4
  1164. #define THREAD_PRIORITY_LOWEST          5
  1165. #define THREAD_PRIORITY_ABOVE_IDLE      6
  1166. #define THREAD_PRIORITY_IDLE            7
  1167.  
  1168. #define THREAD_PRIORITY_ERROR_RETURN    (MAXLONG)
  1169.  
  1170. #define EXCEPTION_DEBUG_EVENT       1
  1171. #define CREATE_THREAD_DEBUG_EVENT   2
  1172. #define CREATE_PROCESS_DEBUG_EVENT  3
  1173. #define EXIT_THREAD_DEBUG_EVENT     4
  1174. #define EXIT_PROCESS_DEBUG_EVENT    5
  1175. #define LOAD_DLL_DEBUG_EVENT        6
  1176. #define UNLOAD_DLL_DEBUG_EVENT      7
  1177. #define OUTPUT_DEBUG_STRING_EVENT   8
  1178. #define RIP_EVENT                   9
  1179.  
  1180. typedef struct _EXCEPTION_DEBUG_INFO {
  1181.     EXCEPTION_RECORD ExceptionRecord;
  1182.     DWORD dwFirstChance;
  1183. } EXCEPTION_DEBUG_INFO, *LPEXCEPTION_DEBUG_INFO;
  1184.  
  1185. typedef struct _CREATE_THREAD_DEBUG_INFO {
  1186.     HANDLE hThread;
  1187.     LPVOID lpThreadLocalBase;
  1188.     LPTHREAD_START_ROUTINE lpStartAddress;
  1189. } CREATE_THREAD_DEBUG_INFO, *LPCREATE_THREAD_DEBUG_INFO;
  1190.  
  1191. typedef struct _CREATE_PROCESS_DEBUG_INFO {
  1192.     HANDLE hFile;
  1193.     HANDLE hProcess;
  1194.     HANDLE hThread;
  1195.     LPVOID lpBaseOfImage;
  1196.     DWORD dwDebugInfoFileOffset;
  1197.     DWORD nDebugInfoSize;
  1198.     LPVOID lpThreadLocalBase;
  1199.     LPTHREAD_START_ROUTINE lpStartAddress;
  1200.     LPVOID lpImageName;
  1201.     WORD fUnicode;
  1202. } CREATE_PROCESS_DEBUG_INFO, *LPCREATE_PROCESS_DEBUG_INFO;
  1203.  
  1204. typedef struct _EXIT_THREAD_DEBUG_INFO {
  1205.     DWORD dwExitCode;
  1206. } EXIT_THREAD_DEBUG_INFO, *LPEXIT_THREAD_DEBUG_INFO;
  1207.  
  1208. typedef struct _EXIT_PROCESS_DEBUG_INFO {
  1209.     DWORD dwExitCode;
  1210. } EXIT_PROCESS_DEBUG_INFO, *LPEXIT_PROCESS_DEBUG_INFO;
  1211.  
  1212. typedef struct _LOAD_DLL_DEBUG_INFO {
  1213.     HANDLE hFile;
  1214.     LPVOID lpBaseOfDll;
  1215.     DWORD dwDebugInfoFileOffset;
  1216.     DWORD nDebugInfoSize;
  1217.     LPVOID lpImageName;
  1218.     WORD fUnicode;
  1219. } LOAD_DLL_DEBUG_INFO, *LPLOAD_DLL_DEBUG_INFO;
  1220.  
  1221. typedef struct _UNLOAD_DLL_DEBUG_INFO {
  1222.     LPVOID lpBaseOfDll;
  1223. } UNLOAD_DLL_DEBUG_INFO, *LPUNLOAD_DLL_DEBUG_INFO;
  1224.  
  1225. typedef struct _OUTPUT_DEBUG_STRING_INFO {
  1226.     LPSTR lpDebugStringData;
  1227.     WORD fUnicode;
  1228.     WORD nDebugStringLength;
  1229. } OUTPUT_DEBUG_STRING_INFO, *LPOUTPUT_DEBUG_STRING_INFO;
  1230.  
  1231. typedef struct _RIP_INFO {
  1232.     DWORD dwError;
  1233.     DWORD dwType;
  1234. } RIP_INFO, *LPRIP_INFO;
  1235.  
  1236. typedef struct _DEBUG_EVENT {
  1237.     DWORD dwDebugEventCode;
  1238.     DWORD dwProcessId;
  1239.     DWORD dwThreadId;
  1240.     union {
  1241.         EXCEPTION_DEBUG_INFO Exception;
  1242.         CREATE_THREAD_DEBUG_INFO CreateThread;
  1243.         CREATE_PROCESS_DEBUG_INFO CreateProcessInfo;
  1244.         EXIT_THREAD_DEBUG_INFO ExitThread;
  1245.         EXIT_PROCESS_DEBUG_INFO ExitProcess;
  1246.         LOAD_DLL_DEBUG_INFO LoadDll;
  1247.         UNLOAD_DLL_DEBUG_INFO UnloadDll;
  1248.         OUTPUT_DEBUG_STRING_INFO DebugString;
  1249.         RIP_INFO RipInfo;
  1250.     } u;
  1251. } DEBUG_EVENT, *LPDEBUG_EVENT;
  1252. #define WAIT_OBJECT_0       0x00000000L
  1253. #define WAIT_ABANDONED      0x00000080L
  1254. #define WAIT_ABANDONED_0    0x00000080L
  1255. #define WAIT_TIMEOUT        0x00000102L
  1256. #define WAIT_FAILED         0xffffffffL
  1257. #define INFINITE            0xffffffffL
  1258.  
  1259. typedef PCONTEXT LPCONTEXT;
  1260.  
  1261. #ifdef UNDER_NT
  1262. typedef struct _RTL_CRITICAL_SECTION_DEBUG {
  1263.     WORD   Type;
  1264.     WORD   CreatorBackTraceIndex;
  1265.     struct _RTL_CRITICAL_SECTION *CriticalSection;
  1266.     LIST_ENTRY ProcessLocksList;
  1267.     DWORD EntryCount;
  1268.     DWORD ContentionCount;
  1269.     DWORD Spare[ 2 ];
  1270. } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG;
  1271.  
  1272. typedef struct _RTL_CRITICAL_SECTION {
  1273.     PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
  1274.  
  1275.     //
  1276.     //  The following three fields control entering and exiting the critical
  1277.     //  section for the resource
  1278.     //
  1279.  
  1280.     LONG LockCount;
  1281.     LONG RecursionCount;
  1282.     HANDLE OwningThread;        // from the thread's ClientId->UniqueThread
  1283.     HANDLE LockSemaphore;
  1284.     DWORD Reserved;
  1285. } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
  1286.  
  1287. typedef RTL_CRITICAL_SECTION CRITICAL_SECTION;
  1288. typedef PRTL_CRITICAL_SECTION PCRITICAL_SECTION;
  1289. typedef PRTL_CRITICAL_SECTION LPCRITICAL_SECTION;
  1290.  
  1291. #else
  1292.  
  1293. typedef struct CRITICAL_SECTION {
  1294.     unsigned int LockCount;         /* Nesting count on critical section */
  1295.     HANDLE OwnerThread;             /* Handle of owner thread */
  1296.     HANDLE hCrit;                    /* Handle to this critical section */
  1297.     DWORD needtrap;                    /* Trap in when freeing critical section */
  1298.     DWORD dwReserved;                /* currently unused */
  1299. } CRITICAL_SECTION, *LPCRITICAL_SECTION;
  1300. #endif
  1301.  
  1302. VOID
  1303. WINAPI
  1304. EnterCriticalSection (
  1305.     LPCRITICAL_SECTION pcsCriticalSection
  1306.     );
  1307.  
  1308. VOID
  1309. WINAPI
  1310. LeaveCriticalSection (
  1311.     LPCRITICAL_SECTION pcsCriticalSection
  1312.     );
  1313.  
  1314. VOID
  1315. WINAPI
  1316. InitializeCriticalSection (
  1317.     LPCRITICAL_SECTION pcsCriticalSection
  1318.     );
  1319.  
  1320. VOID
  1321. WINAPI
  1322. DeleteCriticalSection (
  1323.     LPCRITICAL_SECTION pcsCriticalSection
  1324.     );
  1325.  
  1326. BOOL
  1327. WINAPI
  1328. WaitForDebugEvent(
  1329.     LPDEBUG_EVENT lpDebugEvent,
  1330.     DWORD dwMilliseconds
  1331.     );
  1332.  
  1333. BOOL
  1334. WINAPI
  1335. ContinueDebugEvent(
  1336.     DWORD dwProcessId,
  1337.     DWORD dwThreadId,
  1338.     DWORD dwContinueStatus
  1339.     );
  1340.  
  1341. BOOL
  1342. WINAPI
  1343. DebugActiveProcess(
  1344.     DWORD dwProcessId
  1345.     );
  1346.  
  1347. LPVOID
  1348. WINAPI
  1349. MapViewOfFile(
  1350.     HANDLE hFileMappingObject,
  1351.     DWORD dwDesiredAccess,
  1352.     DWORD dwFileOffsetHigh,
  1353.     DWORD dwFileOffsetLow,
  1354.     DWORD dwNumberOfBytesToMap
  1355.     );
  1356.  
  1357. BOOL
  1358. WINAPI
  1359. UnmapViewOfFile(
  1360.     LPCVOID lpBaseAddress
  1361.     );
  1362.  
  1363. WINBASEAPI
  1364. BOOL
  1365. WINAPI
  1366. FlushViewOfFile(
  1367.     LPCVOID lpBaseAddress,
  1368.     DWORD dwNumberOfBytesToFlush
  1369.     );
  1370.  
  1371. WINBASEAPI
  1372. HANDLE
  1373. WINAPI
  1374. CreateFileMappingA(
  1375.     HANDLE hFile,
  1376.     LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
  1377.     DWORD flProtect,
  1378.     DWORD dwMaximumSizeHigh,
  1379.     DWORD dwMaximumSizeLow,
  1380.     LPCSTR lpName
  1381.     );
  1382.  
  1383. WINBASEAPI
  1384. HANDLE
  1385. WINAPI
  1386. CreateFileMappingW(
  1387.     HANDLE hFile,
  1388.     LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
  1389.     DWORD flProtect,
  1390.     DWORD dwMaximumSizeHigh,
  1391.     DWORD dwMaximumSizeLow,
  1392.     LPCWSTR lpName
  1393.     );
  1394.  
  1395. #ifdef UNICODE
  1396. #define CreateFileMapping  CreateFileMappingW
  1397. #else
  1398. #define CreateFileMapping  CreateFileMappingA
  1399. #endif // !UNICODE
  1400.  
  1401. WINBASEAPI
  1402. HANDLE
  1403. WINAPI
  1404. CreateFileForMappingW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
  1405.     LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
  1406.     HANDLE hTemplateFile);
  1407.  
  1408. #ifdef UNICODE
  1409. #define CreateFileForMapping  CreateFileForMappingW
  1410. #else
  1411. #define CreateFileForMapping  CreateFileForMappingA
  1412. #endif // !UNICODE
  1413.  
  1414. #ifdef _WIN32_WCE_EMULATION
  1415. LPVOID WINAPI MapUncompressedFileW(LPCWSTR pFileName, LPDWORD pLen);
  1416. #else
  1417. LPVOID MapUncompressedFileW(LPCWSTR pFileName, LPDWORD pLen);
  1418. #endif
  1419.  
  1420. #ifdef UNICODE
  1421. #define MapUncompressedFile  MapUncompressedFileW
  1422. #else
  1423. #define MapUncompressedFile  MapUncompressedFileA
  1424. #endif // !UNICODE
  1425.  
  1426. WINBASEAPI
  1427. DWORD
  1428. WINAPI
  1429. GetTempPathA(
  1430.     DWORD nBufferLength,
  1431.     LPSTR lpBuffer
  1432.     );
  1433.  
  1434. WINBASEAPI
  1435. DWORD
  1436. WINAPI
  1437. GetTempPathW(
  1438.     DWORD nBufferLength,
  1439.     LPWSTR lpBuffer
  1440.     );
  1441.  
  1442. #ifdef UNICODE
  1443. #define GetTempPath  GetTempPathW
  1444. #else
  1445. #define GetTempPath  GetTempPathA
  1446. #endif // !UNICODE
  1447.  
  1448. #define TLS_MINIMUM_AVAILABLE   64
  1449.  
  1450. #define CREATE_SUSPENDED 4
  1451. #define CREATE_NEW_CONSOLE 0x10
  1452.  
  1453. HANDLE
  1454. WINAPI
  1455. CreateThread (
  1456.     LPSECURITY_ATTRIBUTES lpsa,
  1457.     DWORD   cbStack,
  1458.     LPTHREAD_START_ROUTINE lpStartAddr,
  1459.     LPVOID lpvThreadParam,
  1460.     DWORD fdwCreate,
  1461.     LPDWORD lpIDThread
  1462.     );
  1463.  
  1464. VOID
  1465. WINAPI
  1466. ExitThread (
  1467.     DWORD   dwExitCode
  1468.     );
  1469.  
  1470. BOOL
  1471. WINAPI
  1472. TerminateThread(
  1473.     HANDLE hThread,
  1474.     DWORD dwExitCode
  1475.     );
  1476.  
  1477. #define STILL_ACTIVE 0x00000103
  1478.  
  1479. LPVOID
  1480. WINAPI
  1481. TlsGetValue (
  1482.     DWORD dwTlsIndex
  1483.     );
  1484.  
  1485. BOOL
  1486. WINAPI
  1487. TlsSetValue (
  1488.     DWORD dwTlsIndex,
  1489.     LPVOID lpvTlsValue
  1490.     );
  1491.  
  1492.  
  1493. typedef struct _PROCESS_INFORMATION {
  1494.     HANDLE  hProcess;
  1495.     HANDLE  hThread;
  1496.     DWORD   dwProcessId;
  1497.     DWORD   dwThreadId;
  1498. } PROCESS_INFORMATION, *LPPROCESS_INFORMATION;
  1499.  
  1500. typedef struct _STARTUPINFOA {
  1501.     DWORD   cb;
  1502.     LPSTR   lpReserved;
  1503.     LPSTR   lpDesktop;
  1504.     LPSTR   lpTitle;
  1505.     DWORD   dwX;
  1506.     DWORD   dwY;
  1507.     DWORD   dwXSize;
  1508.     DWORD   dwYSize;
  1509.     DWORD   dwXCountChars;
  1510.     DWORD   dwYCountChars;
  1511.     DWORD   dwFillAttribute;
  1512.     DWORD   dwFlags;
  1513.     WORD    wShowWindow;
  1514.     WORD    cbReserved2;
  1515.     LPBYTE  lpReserved2;
  1516.     HANDLE  hStdInput;
  1517.     HANDLE  hStdOutput;
  1518.     HANDLE  hStdError;
  1519. } STARTUPINFOA, *LPSTARTUPINFOA;
  1520.  
  1521. typedef struct _STARTUPINFOW {
  1522.     DWORD   cb;
  1523.     LPWSTR  lpReserved;
  1524.     LPWSTR  lpDesktop;
  1525.     LPWSTR  lpTitle;
  1526.     DWORD   dwX;
  1527.     DWORD   dwY;
  1528.     DWORD   dwXSize;
  1529.     DWORD   dwYSize;
  1530.     DWORD   dwXCountChars;
  1531.     DWORD   dwYCountChars;
  1532.     DWORD   dwFillAttribute;
  1533.     DWORD   dwFlags;
  1534.     WORD    wShowWindow;
  1535.     WORD    cbReserved2;
  1536.     LPBYTE  lpReserved2;
  1537.     HANDLE  hStdInput;
  1538.     HANDLE  hStdOutput;
  1539.     HANDLE  hStdError;
  1540. } STARTUPINFOW, *LPSTARTUPINFOW;
  1541.  
  1542. #ifdef UNICODE
  1543. typedef STARTUPINFOW STARTUPINFO;
  1544. typedef LPSTARTUPINFOW LPSTARTUPINFO;
  1545. #else
  1546. typedef STARTUPINFOA STARTUPINFO;
  1547. typedef LPSTARTUPINFOA LPSTARTUPINFO;
  1548. #endif // UNICODE
  1549.  
  1550. BOOL
  1551. WINAPI
  1552. CreateProcessA (
  1553.     LPCSTR pszImageName,
  1554.     LPCSTR pszCmdLine,
  1555.     LPSECURITY_ATTRIBUTES psaProcess,
  1556.     LPSECURITY_ATTRIBUTES psaThread,
  1557.     BOOL fInheritHandles,
  1558.     DWORD fdwCreate,
  1559.     LPVOID pvEnvironment,
  1560.     LPSTR pszCurDir,
  1561.     LPSTARTUPINFO psiStartInfo,
  1562.     LPPROCESS_INFORMATION pProcInfo
  1563.     );
  1564. BOOL
  1565. WINAPI
  1566. CreateProcessW (
  1567.     LPCWSTR pszImageName,
  1568.     LPCWSTR pszCmdLine,
  1569.     LPSECURITY_ATTRIBUTES psaProcess,
  1570.     LPSECURITY_ATTRIBUTES psaThread,
  1571.     BOOL fInheritHandles,
  1572.     DWORD fdwCreate,
  1573.     LPVOID pvEnvironment,
  1574.     LPWSTR pszCurDir,
  1575.     LPSTARTUPINFO psiStartInfo,
  1576.     LPPROCESS_INFORMATION pProcInfo
  1577.     );
  1578. #ifdef UNICODE
  1579. #define CreateProcess CreateProcessW
  1580. #else
  1581. #define CreateProcess CreateProcessA
  1582. #endif
  1583.  
  1584. WINBASEAPI
  1585. DWORD
  1586. WINAPI
  1587. GetProcessVersion(
  1588.     DWORD ProcessId
  1589.     );
  1590.  
  1591. #include <winerror.h>
  1592.  
  1593. //
  1594. //  These are the generic rights.
  1595. //
  1596.  
  1597. #define GENERIC_READ                     (0x80000000L)
  1598. #define GENERIC_WRITE                    (0x40000000L)
  1599. #define GENERIC_EXECUTE                  (0x20000000L)
  1600. #define GENERIC_ALL                      (0x10000000L)
  1601.  
  1602. #define FILE_SHARE_READ                 0x00000001
  1603. #define FILE_SHARE_WRITE                0x00000002
  1604.  
  1605. //
  1606. // File creation flags must start at the high end since they
  1607. // are combined with the attributes
  1608. //
  1609.  
  1610. #define FILE_FLAG_WRITE_THROUGH         0x80000000
  1611. #define FILE_FLAG_OVERLAPPED            0x40000000
  1612. #define FILE_FLAG_NO_BUFFERING          0x20000000
  1613. #define FILE_FLAG_RANDOM_ACCESS         0x10000000
  1614. #define FILE_FLAG_SEQUENTIAL_SCAN       0x08000000
  1615. #define FILE_FLAG_DELETE_ON_CLOSE       0x04000000
  1616. #define FILE_FLAG_BACKUP_SEMANTICS      0x02000000
  1617. #define FILE_FLAG_POSIX_SEMANTICS       0x01000000
  1618.  
  1619. #define CREATE_NEW          1
  1620. #define CREATE_ALWAYS       2
  1621. #define OPEN_EXISTING       3
  1622. #define OPEN_ALWAYS         4
  1623. #define TRUNCATE_EXISTING   5
  1624. #define OPEN_FOR_LOADER        6
  1625.  
  1626. // Windows CE File API definitions copied from NT's winbase.h
  1627.  
  1628. typedef struct _WIN32_FIND_DATAA {
  1629.     DWORD dwFileAttributes;
  1630.     FILETIME ftCreationTime;
  1631.     FILETIME ftLastAccessTime;
  1632.     FILETIME ftLastWriteTime;
  1633.     DWORD nFileSizeHigh;
  1634.     DWORD nFileSizeLow;
  1635.     DWORD dwReserved0;
  1636.     DWORD dwReserved1;
  1637.     CHAR  cFileName[ MAX_PATH ];
  1638.     CHAR  cAlternateFileName[ 14 ];
  1639. } WIN32_FIND_DATAA, *PWIN32_FIND_DATAA, *LPWIN32_FIND_DATAA;
  1640.  
  1641. typedef struct _WIN32_FIND_DATAW {
  1642.     DWORD dwFileAttributes;
  1643.     FILETIME ftCreationTime;
  1644.     FILETIME ftLastAccessTime;
  1645.     FILETIME ftLastWriteTime;
  1646.     DWORD nFileSizeHigh;
  1647.     DWORD nFileSizeLow;
  1648.     DWORD dwOID;
  1649.     WCHAR cFileName[ MAX_PATH ];
  1650. } WIN32_FIND_DATAW, *PWIN32_FIND_DATAW, *LPWIN32_FIND_DATAW;
  1651. #ifdef UNICODE
  1652. typedef WIN32_FIND_DATAW WIN32_FIND_DATA;
  1653. typedef PWIN32_FIND_DATAW PWIN32_FIND_DATA;
  1654. typedef LPWIN32_FIND_DATAW LPWIN32_FIND_DATA;
  1655. #else
  1656. typedef WIN32_FIND_DATAA WIN32_FIND_DATA;
  1657. typedef PWIN32_FIND_DATAA PWIN32_FIND_DATA;
  1658. typedef LPWIN32_FIND_DATAA LPWIN32_FIND_DATA;
  1659. #endif // UNICODE
  1660.  
  1661. WINBASEAPI
  1662. DWORD
  1663. WINAPI
  1664. GetLastError(
  1665.     VOID
  1666.     );
  1667.  
  1668. WINBASEAPI
  1669. DWORD
  1670. WINAPI
  1671. GetTickCount(
  1672.     VOID
  1673.     );
  1674.  
  1675. // @CESYSGEN IF COREDLL_FMTMSG
  1676.  
  1677. WINBASEAPI
  1678. DWORD
  1679. WINAPI
  1680. FormatMessageA(
  1681.     DWORD dwFlags,
  1682.     LPCVOID lpSource,
  1683.     DWORD dwMessageId,
  1684.     DWORD dwLanguageId,
  1685.     LPSTR lpBuffer,
  1686.     DWORD nSize,
  1687.     va_list *Arguments
  1688.     );
  1689.  
  1690. #ifndef COREDLL
  1691. WINBASEAPI
  1692. #endif
  1693. DWORD
  1694. WINAPI
  1695. FormatMessageW(
  1696.     DWORD dwFlags,
  1697.     LPCVOID lpSource,
  1698.     DWORD dwMessageId,
  1699.     DWORD dwLanguageId,
  1700.     LPWSTR lpBuffer,
  1701.     DWORD nSize,
  1702.     va_list *Arguments
  1703.     );
  1704.  
  1705. #ifdef UNICODE
  1706. #define FormatMessage  FormatMessageW
  1707. #else
  1708. #define FormatMessage  FormatMessageA
  1709. #endif // !UNICODE
  1710.  
  1711. // @CESYSGEN ENDIF
  1712.  
  1713. #define FORMAT_MESSAGE_ALLOCATE_BUFFER 0x00000100
  1714. #define FORMAT_MESSAGE_IGNORE_INSERTS  0x00000200
  1715. #define FORMAT_MESSAGE_FROM_STRING     0x00000400
  1716. #define FORMAT_MESSAGE_FROM_HMODULE    0x00000800
  1717. #define FORMAT_MESSAGE_FROM_SYSTEM     0x00001000
  1718. #define FORMAT_MESSAGE_ARGUMENT_ARRAY  0x00002000
  1719. #define FORMAT_MESSAGE_MAX_WIDTH_MASK  0x000000FF
  1720.  
  1721. WINBASEAPI
  1722. BOOL
  1723. WINAPI
  1724. CloseHandle(
  1725.     HANDLE hObject
  1726.     );
  1727.  
  1728. WINBASEAPI
  1729. HGLOBAL
  1730. WINAPI
  1731. LoadResource(
  1732.     HMODULE hModule,
  1733.     HRSRC hResInfo
  1734.     );
  1735.  
  1736. WINBASEAPI
  1737. DWORD
  1738. WINAPI
  1739. SizeofResource(
  1740.     HMODULE hModule,
  1741.     HRSRC hResInfo
  1742.     );
  1743.  
  1744. WINBASEAPI
  1745. HRSRC
  1746. WINAPI
  1747. FindResourceA(
  1748.     HMODULE hModule,
  1749.     LPCSTR lpName,
  1750.     LPCSTR lpType
  1751.     );
  1752.  
  1753. WINBASEAPI
  1754. HRSRC
  1755. WINAPI
  1756. FindResourceW(
  1757.     HMODULE hModule,
  1758.     LPCWSTR lpName,
  1759.     LPCWSTR lpType
  1760.     );
  1761.  
  1762. #ifdef UNICODE
  1763. #define FindResource  FindResourceW
  1764. #else
  1765. #define FindResource  FindResourceA
  1766. #endif  // !UNICODE
  1767.  
  1768.  
  1769. #if !defined(UNDER_CE)   // The WinCE case is in kfuncs.h
  1770. WINBASEAPI
  1771. LPVOID
  1772. WINAPI
  1773. LockResource(
  1774.         HGLOBAL hResData
  1775.         );
  1776. #endif
  1777.  
  1778. WINBASEAPI
  1779. BOOL
  1780. WINAPI
  1781. TerminateProcess(
  1782.     HANDLE hProcess,
  1783.     DWORD uExitCode
  1784.     );
  1785.  
  1786. BOOL
  1787. WINAPI
  1788. FlushInstructionCache(
  1789.     HANDLE hProcess,
  1790.     LPCVOID lpBaseAddress,
  1791.     DWORD dwSize
  1792.     );
  1793.  
  1794. BOOL
  1795. WINAPI
  1796. ReadProcessMemory(
  1797.     HANDLE hProcess,
  1798.     LPCVOID lpBaseAddress,
  1799.     LPVOID lpBuffer,
  1800.     DWORD nSize,
  1801.     LPDWORD lpNumberOfBytesRead
  1802.     );
  1803.  
  1804. BOOL
  1805. WINAPI
  1806. WriteProcessMemory(
  1807.     HANDLE hProcess,
  1808.     LPVOID lpBaseAddress,
  1809.     LPVOID lpBuffer,
  1810.     DWORD nSize,
  1811.     LPDWORD lpNumberOfBytesWritten
  1812.     );
  1813.  
  1814. HANDLE
  1815. WINAPI
  1816. OpenProcess(
  1817.     DWORD fdwAccess,
  1818.     BOOL fInherit,
  1819.     DWORD IDProcess
  1820.     );
  1821.  
  1822. WINBASEAPI
  1823. BOOL
  1824. WINAPI
  1825. GetThreadContext(
  1826.     HANDLE hThread,
  1827.     LPCONTEXT lpContext
  1828.     );
  1829.  
  1830. WINBASEAPI
  1831. BOOL
  1832. WINAPI
  1833. SetThreadContext(
  1834.     HANDLE hThread,
  1835.     CONST CONTEXT *lpContext
  1836.     );
  1837.  
  1838. WINBASEAPI
  1839. DWORD
  1840. WINAPI
  1841. SuspendThread(
  1842.     HANDLE hThread
  1843.     );
  1844. WINBASEAPI
  1845. DWORD
  1846. WINAPI
  1847. ResumeThread(
  1848.     HANDLE hThread
  1849.     );
  1850.  
  1851. WINBASEAPI
  1852. BOOL
  1853. WINAPI
  1854. GetThreadTimes(
  1855.     HANDLE hThread,
  1856.     LPFILETIME lpCreationTime,
  1857.     LPFILETIME lpExitTime,
  1858.     LPFILETIME lpKernelTime,
  1859.     LPFILETIME lpUserTime
  1860.     );
  1861.  
  1862. WINBASEAPI
  1863. int
  1864. WINAPI
  1865. GetThreadPriority(
  1866.     HANDLE hThread
  1867.     );
  1868.  
  1869.  
  1870. WINBASEAPI
  1871. BOOL
  1872. WINAPI
  1873. SetThreadPriority(
  1874.     HANDLE hThread,
  1875.     int nPriority
  1876.     );
  1877.  
  1878. WINBASEAPI
  1879. VOID
  1880. WINAPI
  1881. SetLastError(
  1882.     DWORD dwErrCode
  1883.     );
  1884.  
  1885. // @CESYSGEN IF FILESYS_FSMAIN
  1886.  
  1887. #ifdef _WIN32_WCE_EMULATION
  1888. BOOL WINAPI GetDiskFreeSpaceExA(LPCSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller,
  1889.     PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes);
  1890.  
  1891. BOOL WINAPI GetDiskFreeSpaceExW(LPCWSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller,
  1892.     PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes);
  1893. #else
  1894. BOOL GetDiskFreeSpaceExA(LPCSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller,
  1895.     PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes);
  1896.  
  1897. BOOL GetDiskFreeSpaceExW(LPCWSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller,
  1898.     PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes);
  1899. #endif
  1900.  
  1901. #ifdef UNICODE
  1902. #define GetDiskFreeSpaceEx  GetDiskFreeSpaceExW
  1903. #else
  1904. #define GetDiskFreeSpaceEx  GetDiskFreeSpaceExA
  1905. #endif // !UNICODE
  1906.  
  1907. WINBASEAPI
  1908. HANDLE
  1909. WINAPI
  1910. CreateFileA(
  1911.     LPCSTR lpFileName,
  1912.     DWORD dwDesiredAccess,
  1913.     DWORD dwShareMode,
  1914.     LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  1915.     DWORD dwCreationDisposition,
  1916.     DWORD dwFlagsAndAttributes,
  1917.     HANDLE hTemplateFile
  1918.     );
  1919.  
  1920. WINBASEAPI
  1921. HANDLE
  1922. WINAPI
  1923. CreateFileW(
  1924.     LPCWSTR lpFileName,
  1925.     DWORD dwDesiredAccess,
  1926.     DWORD dwShareMode,
  1927.     LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  1928.     DWORD dwCreationDisposition,
  1929.     DWORD dwFlagsAndAttributes,
  1930.     HANDLE hTemplateFile
  1931.     );
  1932. #ifdef UNICODE
  1933. #define CreateFile  CreateFileW
  1934. #else
  1935. #define CreateFile  CreateFileA
  1936. #endif // !UNICODE
  1937.  
  1938. WINBASEAPI
  1939. BOOL
  1940. WINAPI
  1941. DeleteFileA(
  1942.     LPCSTR lpFileName
  1943.     );
  1944. WINBASEAPI
  1945. BOOL
  1946. WINAPI
  1947. DeleteFileW(
  1948.     LPCWSTR lpFileName
  1949.     );
  1950. #ifdef UNICODE
  1951. #define DeleteFile  DeleteFileW
  1952. #else
  1953. #define DeleteFile  DeleteFileA
  1954. #endif // !UNICODE
  1955.  
  1956. WINBASEAPI
  1957. BOOL
  1958. WINAPI
  1959. DeleteAndRenameFile(
  1960.     LPCWSTR lpOldFileName,
  1961.     LPCWSTR lpNewFileName
  1962.     );
  1963.  
  1964. WINBASEAPI
  1965. HANDLE
  1966. WINAPI
  1967. FindFirstFileA(
  1968.     LPCSTR lpFileName,
  1969.     LPWIN32_FIND_DATAA lpFindFileData
  1970.     );
  1971.  
  1972. WINBASEAPI
  1973. HANDLE
  1974. WINAPI
  1975. FindFirstFileW(
  1976.     LPCWSTR lpFileName,
  1977.     LPWIN32_FIND_DATAW lpFindFileData
  1978.     );
  1979. #ifdef UNICODE
  1980. #define FindFirstFile  FindFirstFileW
  1981. #else
  1982. #define FindFirstFile  FindFirstFileA
  1983. #endif // !UNICODE
  1984.  
  1985. WINBASEAPI
  1986. BOOL
  1987. WINAPI
  1988. FindNextFileA(
  1989.     HANDLE hFindFile,
  1990.     LPWIN32_FIND_DATAA lpFindFileData
  1991.     );
  1992.  
  1993. WINBASEAPI
  1994. BOOL
  1995. WINAPI
  1996. FindNextFileW(
  1997.     HANDLE hFindFile,
  1998.     LPWIN32_FIND_DATAW lpFindFileData
  1999.     );
  2000. #ifdef UNICODE
  2001. #define FindNextFile  FindNextFileW
  2002. #else
  2003. #define FindNextFile  FindNextFileA
  2004. #endif // !UNICODE
  2005.  
  2006. WINBASEAPI
  2007. BOOL
  2008. WINAPI
  2009. CopyFileA(
  2010.     LPCSTR lpExistingFileName,
  2011.     LPCSTR lpNewFileName,
  2012.     BOOL bFailIfExists
  2013.     );
  2014. WINBASEAPI
  2015. BOOL
  2016. WINAPI
  2017. CopyFileW(
  2018.     LPCWSTR lpExistingFileName,
  2019.     LPCWSTR lpNewFileName,
  2020.     BOOL bFailIfExists
  2021.     );
  2022. #ifdef UNICODE
  2023. #define CopyFile  CopyFileW
  2024. #else
  2025. #define CopyFile  CopyFileA
  2026. #endif // !UNICODE
  2027.  
  2028. WINBASEAPI
  2029. BOOL
  2030. WINAPI
  2031. MoveFileA(
  2032.     LPCSTR lpExistingFileName,
  2033.     LPCSTR lpNewFileName
  2034.     );
  2035. WINBASEAPI
  2036. BOOL
  2037. WINAPI
  2038. MoveFileW(
  2039.     LPCWSTR lpExistingFileName,
  2040.     LPCWSTR lpNewFileName
  2041.     );
  2042. #ifdef UNICODE
  2043. #define MoveFile  MoveFileW
  2044. #else
  2045. #define MoveFile  MoveFileA
  2046. #endif // !UNICODE
  2047.  
  2048.  
  2049. WINBASEAPI
  2050. BOOL
  2051. WINAPI
  2052. CreateDirectoryA(
  2053.     LPCSTR lpPathName,
  2054.     LPSECURITY_ATTRIBUTES lpSecurityAttributes
  2055.     );
  2056. WINBASEAPI
  2057. BOOL
  2058. WINAPI
  2059. CreateDirectoryW(
  2060.     LPCWSTR lpPathName,
  2061.     LPSECURITY_ATTRIBUTES lpSecurityAttributes
  2062.     );
  2063. #ifdef UNICODE
  2064. #define CreateDirectory  CreateDirectoryW
  2065. #else
  2066. #define CreateDirectory  CreateDirectoryA
  2067. #endif // !UNICODE
  2068.  
  2069. WINBASEAPI
  2070. BOOL
  2071. WINAPI
  2072. RemoveDirectoryA(
  2073.     LPCSTR lpPathName
  2074.     );
  2075. WINBASEAPI
  2076. BOOL
  2077. WINAPI
  2078. RemoveDirectoryW(
  2079.     LPCWSTR lpPathName
  2080.     );
  2081. #ifdef UNICODE
  2082. #define RemoveDirectory  RemoveDirectoryW
  2083. #else
  2084. #define RemoveDirectory  RemoveDirectoryA
  2085. #endif // !UNICODE
  2086.  
  2087. WINBASEAPI
  2088. BOOL
  2089. WINAPI
  2090. WriteFile(
  2091.     HANDLE hFile,
  2092.     LPCVOID lpBuffer,
  2093.     DWORD nNumberOfBytesToWrite,
  2094.     LPDWORD lpNumberOfBytesWritten,
  2095.     LPOVERLAPPED lpOverlapped
  2096.     );
  2097.  
  2098. WINBASEAPI
  2099. BOOL
  2100. WINAPI
  2101. ReadFile(
  2102.     HANDLE hFile,
  2103.     LPVOID lpBuffer,
  2104.     DWORD nNumberOfBytesToRead,
  2105.     LPDWORD lpNumberOfBytesRead,
  2106.     LPOVERLAPPED lpOverlapped
  2107.     );
  2108.  
  2109. WINBASEAPI BOOL WINAPI FlushFileBuffers (HANDLE hFile);
  2110. WINBASEAPI BOOL WINAPI GetFileTime (HANDLE hFile, LPFILETIME lpCreation, LPFILETIME lpLastAccess, LPFILETIME lpLastWrite);
  2111. WINBASEAPI BOOL WINAPI SetFileTime (HANDLE hFile, CONST FILETIME *lpCreation, CONST FILETIME *lpLastAccess, CONST FILETIME *lpLastWrite);
  2112. WINBASEAPI BOOL WINAPI SetEndOfFile (HANDLE hFile);
  2113. WINBASEAPI BOOL WINAPI DeviceIoControl (HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuf, DWORD nInBufSize, LPVOID lpOutBuf, DWORD nOutBufSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped);
  2114.  
  2115. // @CESYSGEN IF COREDLL_ASYNCIO
  2116.  
  2117.  
  2118. // @CESYSGEN ENDIF
  2119.  
  2120. WINBASEAPI
  2121. BOOL
  2122. WINAPI
  2123. SetFileAttributesA(
  2124.     LPCSTR lpFileName,
  2125.     DWORD dwFileAttributes
  2126.     );
  2127. WINBASEAPI
  2128. BOOL
  2129. WINAPI
  2130. SetFileAttributesW(
  2131.     LPCWSTR lpFileName,
  2132.     DWORD dwFileAttributes
  2133.     );
  2134. #ifdef UNICODE
  2135. #define SetFileAttributes  SetFileAttributesW
  2136. #else
  2137. #define SetFileAttributes  SetFileAttributesA
  2138. #endif // !UNICODE
  2139.  
  2140. WINBASEAPI
  2141. DWORD
  2142. WINAPI
  2143. SetFilePointer(
  2144.     HANDLE hFile,
  2145.     LONG lDistanceToMove,
  2146.     PLONG lpDistanceToMoveHigh,
  2147.     DWORD dwMoveMethod
  2148.     );
  2149.  
  2150. WINBASEAPI
  2151. BOOL
  2152. WINAPI
  2153. FindClose(
  2154.     HANDLE hFindFile
  2155.     );
  2156.  
  2157.  
  2158. WINBASEAPI
  2159. DWORD
  2160. WINAPI
  2161. GetFileSize(
  2162.     HANDLE hFile,
  2163.     LPDWORD lpFileSizeHigh
  2164.     );
  2165.  
  2166. WINBASEAPI
  2167. DWORD
  2168. WINAPI
  2169. GetFileAttributesA(
  2170.     LPCSTR lpFileName
  2171.     );
  2172. WINBASEAPI
  2173. DWORD
  2174. WINAPI
  2175. GetFileAttributesW(
  2176.     LPCWSTR lpFileName
  2177.     );
  2178. #ifdef UNICODE
  2179. #define GetFileAttributes  GetFileAttributesW
  2180. #else
  2181. #define GetFileAttributes  GetFileAttributesA
  2182. #endif // !UNICODE
  2183.  
  2184. typedef struct _BY_HANDLE_FILE_INFORMATION {
  2185.     DWORD dwFileAttributes;
  2186.     FILETIME ftCreationTime;
  2187.     FILETIME ftLastAccessTime;
  2188.     FILETIME ftLastWriteTime;
  2189.     DWORD dwVolumeSerialNumber;
  2190.     DWORD nFileSizeHigh;
  2191.     DWORD nFileSizeLow;
  2192.     DWORD nNumberOfLinks;
  2193.     DWORD nFileIndexHigh;
  2194.     DWORD nFileIndexLow;
  2195.     DWORD dwOID;
  2196. } BY_HANDLE_FILE_INFORMATION, *PBY_HANDLE_FILE_INFORMATION, *LPBY_HANDLE_FILE_INFORMATION;
  2197.  
  2198. WINBASEAPI
  2199. BOOL
  2200. WINAPI
  2201. GetFileInformationByHandle(
  2202.     HANDLE hFile,
  2203.     LPBY_HANDLE_FILE_INFORMATION lpFileInformation
  2204.     );
  2205.  
  2206. // @CESYSGEN ENDIF
  2207.  
  2208. WINBASEAPI
  2209. VOID
  2210. WINAPI
  2211. Sleep(
  2212.     DWORD dwMilliseconds
  2213.     );
  2214.  
  2215. WINBASEAPI
  2216. HANDLE
  2217. WINAPI
  2218. CreateMutexA(
  2219.     LPSECURITY_ATTRIBUTES lpsa,
  2220.     BOOL bInitialOwner,
  2221.     LPCSTR lpName);
  2222.  
  2223. WINBASEAPI
  2224. HANDLE
  2225. WINAPI
  2226. CreateMutexW(
  2227.     LPSECURITY_ATTRIBUTES lpsa,
  2228.     BOOL bInitialOwner,
  2229.     LPCWSTR lpName);
  2230.  
  2231. #ifdef UNICODE
  2232. #define CreateMutex  CreateMutexW
  2233. #else
  2234. #define CreateMutex  CreateMutexA
  2235. #endif // !UNICODE
  2236.  
  2237. WINBASEAPI
  2238. HANDLE
  2239. WINAPI
  2240. CreateEventA(
  2241.     LPSECURITY_ATTRIBUTES lpEventAttributes,
  2242.     BOOL bManualReset,
  2243.     BOOL bInitialState,
  2244.     LPCSTR lpName
  2245.     );
  2246.  
  2247. WINBASEAPI
  2248. HANDLE
  2249. WINAPI
  2250. CreateEventW(
  2251.     LPSECURITY_ATTRIBUTES lpEventAttributes,
  2252.     BOOL bManualReset,
  2253.     BOOL bInitialState,
  2254.     LPCWSTR lpName
  2255.     );
  2256. #ifdef UNICODE
  2257. #define CreateEvent  CreateEventW
  2258. #else
  2259. #define CreateEvent  CreateEventA
  2260. #endif // !UNICODE
  2261.  
  2262. #ifndef UNDER_CE    // The WinCE case is in kfuncs.h
  2263. WINBASEAPI
  2264. BOOL
  2265. WINAPI
  2266. SetEvent(
  2267.     HANDLE hEvent
  2268.     );
  2269.  
  2270. WINBASEAPI
  2271. BOOL
  2272. WINAPI
  2273. ResetEvent(
  2274.     HANDLE hEvent
  2275.     );
  2276.  
  2277. WINBASEAPI
  2278. BOOL
  2279. WINAPI
  2280. PulseEvent(
  2281.     HANDLE hEvent
  2282.     );
  2283. #endif
  2284.  
  2285. WINBASEAPI
  2286. BOOL
  2287. WINAPI
  2288. ReleaseMutex(
  2289.     HANDLE hMutex
  2290.     );
  2291.  
  2292. WINBASEAPI
  2293. DWORD
  2294. WINAPI
  2295. WaitForSingleObject(
  2296.     HANDLE hHandle,
  2297.     DWORD dwMilliseconds
  2298.     );
  2299.  
  2300. WINBASEAPI
  2301. DWORD
  2302. WINAPI
  2303. WaitForMultipleObjects(
  2304.     DWORD cObjects,
  2305.     CONST HANDLE *lphObjects,
  2306.     BOOL fWaitAll,
  2307.     DWORD dwTimeout
  2308.     );
  2309.  
  2310. WINBASEAPI
  2311. BOOL
  2312. WINAPI
  2313. GetExitCodeThread(
  2314.     HANDLE hThread,
  2315.     LPDWORD lpExitCode
  2316.     );
  2317.  
  2318. WINBASEAPI
  2319. BOOL
  2320. WINAPI
  2321. GetExitCodeProcess(
  2322.     HANDLE hProcess,
  2323.     LPDWORD lpExitCode
  2324.     );
  2325.  
  2326. #if !defined(UNDER_CE) && !defined(_WIN32_WCE_EMULATION)    // The WinCE case is in kfuncs.h
  2327. WINBASEAPI
  2328. HANDLE
  2329. WINAPI
  2330. GetCurrentThread(
  2331.     VOID
  2332.     );
  2333.  
  2334. WINBASEAPI
  2335. HANDLE
  2336. WINAPI
  2337. GetCurrentProcess(
  2338.     VOID
  2339.     );
  2340.  
  2341. WINBASEAPI
  2342. DWORD
  2343. WINAPI
  2344. GetCurrentThreadId(
  2345.     VOID
  2346.     );
  2347.  
  2348. WINBASEAPI
  2349. DWORD
  2350. WINAPI
  2351. GetCurrentProcessId(
  2352.     VOID
  2353.     );
  2354. #endif
  2355.  
  2356. DWORD
  2357. WINAPI
  2358. TlsAlloc(
  2359.     VOID
  2360.     );
  2361.  
  2362. WINBASEAPI
  2363. BOOL
  2364. WINAPI
  2365. IsBadCodePtr(
  2366.     FARPROC lpfn
  2367.     );
  2368.  
  2369. WINBASEAPI
  2370. BOOL
  2371. WINAPI
  2372. IsBadReadPtr(
  2373.     CONST VOID *lp,
  2374.     UINT ucb
  2375.     );
  2376.  
  2377. BOOL
  2378. WINAPI
  2379. TlsFree(
  2380.     DWORD dwTlsIndex
  2381.     );
  2382.  
  2383. WINBASEAPI
  2384. BOOL
  2385. WINAPI
  2386. IsBadWritePtr(
  2387.     LPVOID lp,
  2388.     UINT ucb
  2389.     );
  2390.  
  2391. WINBASEAPI
  2392. VOID
  2393. WINAPI
  2394. GetSystemInfo(
  2395.     LPSYSTEM_INFO lpSystemInfo
  2396.     );
  2397.  
  2398. WINBASEAPI
  2399. VOID
  2400. WINAPI
  2401. RaiseException(
  2402.     DWORD dwExceptionCode,
  2403.     DWORD dwExceptionFlags,
  2404.     DWORD nNumberOfArguments,
  2405.     CONST DWORD *lpArguments
  2406.     );
  2407.  
  2408. WINBASEAPI
  2409. BOOL
  2410. WINAPI
  2411. FreeLibrary(
  2412.     HMODULE hLibModule
  2413.     );
  2414.  
  2415. WINBASEAPI
  2416. VOID
  2417. WINAPI
  2418. FreeLibraryAndExitThread(
  2419.     HMODULE hLibModule,
  2420.     DWORD dwExitCode
  2421.     );
  2422.  
  2423. #ifdef UNDER_CE
  2424. #include <windbase.h>
  2425. #include <dbgapi.h>
  2426. #include <kfuncs.h>
  2427. #ifdef WINCEOEM
  2428. #include <pwinbase.h>
  2429. #endif
  2430. #endif
  2431.  
  2432. #define FILE_MAP_WRITE      SECTION_MAP_WRITE
  2433. #define FILE_MAP_READ       SECTION_MAP_READ
  2434. #define FILE_MAP_ALL_ACCESS SECTION_ALL_ACCESS
  2435.  
  2436. // @CESYSGEN IF COREDLL_SERDEV
  2437.  
  2438. //
  2439. // Serial provider type.
  2440. //
  2441.  
  2442. #define SP_SERIALCOMM    ((DWORD)0x00000001)
  2443.  
  2444. //
  2445. // Provider SubTypes
  2446. //
  2447.  
  2448. #define PST_UNSPECIFIED      ((DWORD)0x00000000)
  2449. #define PST_RS232            ((DWORD)0x00000001)
  2450. #define PST_PARALLELPORT     ((DWORD)0x00000002)
  2451. #define PST_RS422            ((DWORD)0x00000003)
  2452. #define PST_RS423            ((DWORD)0x00000004)
  2453. #define PST_RS449            ((DWORD)0x00000005)
  2454. #define PST_MODEM            ((DWORD)0x00000006)
  2455. #define PST_FAX              ((DWORD)0x00000021)
  2456. #define PST_SCANNER          ((DWORD)0x00000022)
  2457. #define PST_NETWORK_BRIDGE   ((DWORD)0x00000100)
  2458. #define PST_LAT              ((DWORD)0x00000101)
  2459. #define PST_TCPIP_TELNET     ((DWORD)0x00000102)
  2460. #define PST_X25              ((DWORD)0x00000103)
  2461.  
  2462.  
  2463. //
  2464. // Provider capabilities flags.
  2465. //
  2466.  
  2467. #define PCF_DTRDSR        ((DWORD)0x0001)
  2468. #define PCF_RTSCTS        ((DWORD)0x0002)
  2469. #define PCF_RLSD          ((DWORD)0x0004)
  2470. #define PCF_PARITY_CHECK  ((DWORD)0x0008)
  2471. #define PCF_XONXOFF       ((DWORD)0x0010)
  2472. #define PCF_SETXCHAR      ((DWORD)0x0020)
  2473. #define PCF_TOTALTIMEOUTS ((DWORD)0x0040)
  2474. #define PCF_INTTIMEOUTS   ((DWORD)0x0080)
  2475. #define PCF_SPECIALCHARS  ((DWORD)0x0100)
  2476. #define PCF_16BITMODE     ((DWORD)0x0200)
  2477.  
  2478. //
  2479. // Comm provider settable parameters.
  2480. //
  2481.  
  2482. #define SP_PARITY         ((DWORD)0x0001)
  2483. #define SP_BAUD           ((DWORD)0x0002)
  2484. #define SP_DATABITS       ((DWORD)0x0004)
  2485. #define SP_STOPBITS       ((DWORD)0x0008)
  2486. #define SP_HANDSHAKING    ((DWORD)0x0010)
  2487. #define SP_PARITY_CHECK   ((DWORD)0x0020)
  2488. #define SP_RLSD           ((DWORD)0x0040)
  2489.  
  2490. //
  2491. // Settable baud rates in the provider.
  2492. //
  2493.  
  2494. #define BAUD_075          ((DWORD)0x00000001)
  2495. #define BAUD_110          ((DWORD)0x00000002)
  2496. #define BAUD_134_5        ((DWORD)0x00000004)
  2497. #define BAUD_150          ((DWORD)0x00000008)
  2498. #define BAUD_300          ((DWORD)0x00000010)
  2499. #define BAUD_600          ((DWORD)0x00000020)
  2500. #define BAUD_1200         ((DWORD)0x00000040)
  2501. #define BAUD_1800         ((DWORD)0x00000080)
  2502. #define BAUD_2400         ((DWORD)0x00000100)
  2503. #define BAUD_4800         ((DWORD)0x00000200)
  2504. #define BAUD_7200         ((DWORD)0x00000400)
  2505. #define BAUD_9600         ((DWORD)0x00000800)
  2506. #define BAUD_14400        ((DWORD)0x00001000)
  2507. #define BAUD_19200        ((DWORD)0x00002000)
  2508. #define BAUD_38400        ((DWORD)0x00004000)
  2509. #define BAUD_56K          ((DWORD)0x00008000)
  2510. #define BAUD_128K         ((DWORD)0x00010000)
  2511. #define BAUD_115200       ((DWORD)0x00020000)
  2512. #define BAUD_57600        ((DWORD)0x00040000)
  2513. #define BAUD_USER         ((DWORD)0x10000000)
  2514.  
  2515. //
  2516. // Settable Data Bits
  2517. //
  2518.  
  2519. #define DATABITS_5        ((WORD)0x0001)
  2520. #define DATABITS_6        ((WORD)0x0002)
  2521. #define DATABITS_7        ((WORD)0x0004)
  2522. #define DATABITS_8        ((WORD)0x0008)
  2523. #define DATABITS_16       ((WORD)0x0010)
  2524. #define DATABITS_16X      ((WORD)0x0020)
  2525.  
  2526. //
  2527. // Settable Stop and Parity bits.
  2528. //
  2529.  
  2530. #define STOPBITS_10       ((WORD)0x0001)
  2531. #define STOPBITS_15       ((WORD)0x0002)
  2532. #define STOPBITS_20       ((WORD)0x0004)
  2533. #define PARITY_NONE       ((WORD)0x0100)
  2534. #define PARITY_ODD        ((WORD)0x0200)
  2535. #define PARITY_EVEN       ((WORD)0x0400)
  2536. #define PARITY_MARK       ((WORD)0x0800)
  2537. #define PARITY_SPACE      ((WORD)0x1000)
  2538.  
  2539. typedef struct _COMMPROP {
  2540.     WORD wPacketLength;
  2541.     WORD wPacketVersion;
  2542.     DWORD dwServiceMask;
  2543.     DWORD dwReserved1;
  2544.     DWORD dwMaxTxQueue;
  2545.     DWORD dwMaxRxQueue;
  2546.     DWORD dwMaxBaud;
  2547.     DWORD dwProvSubType;
  2548.     DWORD dwProvCapabilities;
  2549.     DWORD dwSettableParams;
  2550.     DWORD dwSettableBaud;
  2551.     WORD wSettableData;
  2552.     WORD wSettableStopParity;
  2553.     DWORD dwCurrentTxQueue;
  2554.     DWORD dwCurrentRxQueue;
  2555.     DWORD dwProvSpec1;
  2556.     DWORD dwProvSpec2;
  2557.     WCHAR wcProvChar[1];
  2558. } COMMPROP,*LPCOMMPROP;
  2559.  
  2560. //
  2561. // Set dwProvSpec1 to COMMPROP_INITIALIZED to indicate that wPacketLength
  2562. // is valid before a call to GetCommProperties().
  2563. //
  2564. #define COMMPROP_INITIALIZED ((DWORD)0xE73CF52E)
  2565.  
  2566. typedef struct _COMSTAT {
  2567.     DWORD fCtsHold : 1;
  2568.     DWORD fDsrHold : 1;
  2569.     DWORD fRlsdHold : 1;
  2570.     DWORD fXoffHold : 1;
  2571.     DWORD fXoffSent : 1;
  2572.     DWORD fEof : 1;
  2573.     DWORD fTxim : 1;
  2574.     DWORD fReserved : 25;
  2575.     DWORD cbInQue;
  2576.     DWORD cbOutQue;
  2577. } COMSTAT, *LPCOMSTAT;
  2578.  
  2579. //
  2580. // DTR Control Flow Values.
  2581. //
  2582. #define DTR_CONTROL_DISABLE    0x00
  2583. #define DTR_CONTROL_ENABLE     0x01
  2584. #define DTR_CONTROL_HANDSHAKE  0x02
  2585.  
  2586. //
  2587. // RTS Control Flow Values
  2588. //
  2589. #define RTS_CONTROL_DISABLE    0x00
  2590. #define RTS_CONTROL_ENABLE     0x01
  2591. #define RTS_CONTROL_HANDSHAKE  0x02
  2592. #define RTS_CONTROL_TOGGLE     0x03
  2593.  
  2594. typedef struct _DCB {
  2595.     DWORD DCBlength;      /* sizeof(DCB)                     */
  2596.     DWORD BaudRate;       /* Baudrate at which running       */
  2597.     DWORD fBinary: 1;     /* Binary Mode (skip EOF check)    */
  2598.     DWORD fParity: 1;     /* Enable parity checking          */
  2599.     DWORD fOutxCtsFlow:1; /* CTS handshaking on output       */
  2600.     DWORD fOutxDsrFlow:1; /* DSR handshaking on output       */
  2601.     DWORD fDtrControl:2;  /* DTR Flow control                */
  2602.     DWORD fDsrSensitivity:1; /* DSR Sensitivity              */
  2603.     DWORD fTXContinueOnXoff: 1; /* Continue TX when Xoff sent */
  2604.     DWORD fOutX: 1;       /* Enable output X-ON/X-OFF        */
  2605.     DWORD fInX: 1;        /* Enable input X-ON/X-OFF         */
  2606.     DWORD fErrorChar: 1;  /* Enable Err Replacement          */
  2607.     DWORD fNull: 1;       /* Enable Null stripping           */
  2608.     DWORD fRtsControl:2;  /* Rts Flow control                */
  2609.     DWORD fAbortOnError:1; /* Abort all reads and writes on Error */
  2610.     DWORD fDummy2:17;     /* Reserved                        */
  2611.     WORD wReserved;       /* Not currently used              */
  2612.     WORD XonLim;          /* Transmit X-ON threshold         */
  2613.     WORD XoffLim;         /* Transmit X-OFF threshold        */
  2614.     BYTE ByteSize;        /* Number of bits/byte, 4-8        */
  2615.     BYTE Parity;          /* 0-4=None,Odd,Even,Mark,Space    */
  2616.     BYTE StopBits;        /* 0,1,2 = 1, 1.5, 2               */
  2617.     char XonChar;         /* Tx and Rx X-ON character        */
  2618.     char XoffChar;        /* Tx and Rx X-OFF character       */
  2619.     char ErrorChar;       /* Error replacement char          */
  2620.     char EofChar;         /* End of Input character          */
  2621.     char EvtChar;         /* Received Event character        */
  2622.     WORD wReserved1;      /* Fill for now.                   */
  2623. } DCB, *LPDCB;
  2624.  
  2625. typedef struct _COMMTIMEOUTS {
  2626.     DWORD ReadIntervalTimeout;          /* Maximum time between read chars. */
  2627.     DWORD ReadTotalTimeoutMultiplier;   /* Multiplier of characters.        */
  2628.     DWORD ReadTotalTimeoutConstant;     /* Constant in milliseconds.        */
  2629.     DWORD WriteTotalTimeoutMultiplier;  /* Multiplier of characters.        */
  2630.     DWORD WriteTotalTimeoutConstant;    /* Constant in milliseconds.        */
  2631. } COMMTIMEOUTS,*LPCOMMTIMEOUTS;
  2632.  
  2633. typedef struct _COMMCONFIG {
  2634.     DWORD dwSize;               /* Size of the entire struct */
  2635.     WORD wVersion;              /* version of the structure */
  2636.     WORD wReserved;             /* alignment */
  2637.     DCB dcb;                    /* device control block */
  2638.     DWORD dwProviderSubType;    /* ordinal value for identifying
  2639.                                    provider-defined data structure format*/
  2640.     DWORD dwProviderOffset;     /* Specifies the offset of provider specific
  2641.                                    data field in bytes from the start */
  2642.     DWORD dwProviderSize;       /* size of the provider-specific data field */
  2643.     WCHAR wcProviderData[1];    /* provider-specific data */
  2644. } COMMCONFIG,*LPCOMMCONFIG;
  2645.  
  2646. #define NOPARITY            0
  2647. #define ODDPARITY           1
  2648. #define EVENPARITY          2
  2649. #define MARKPARITY          3
  2650. #define SPACEPARITY         4
  2651.  
  2652. #define ONESTOPBIT          0
  2653. #define ONE5STOPBITS        1
  2654. #define TWOSTOPBITS         2
  2655.  
  2656. #define IGNORE              0       // Ignore signal
  2657.  
  2658. //
  2659. // Basud rates at which the communication device operates
  2660. //
  2661.  
  2662. #define CBR_110             110
  2663. #define CBR_300             300
  2664. #define CBR_600             600
  2665. #define CBR_1200            1200
  2666. #define CBR_2400            2400
  2667. #define CBR_4800            4800
  2668. #define CBR_9600            9600
  2669. #define CBR_14400           14400
  2670. #define CBR_19200           19200
  2671. #define CBR_38400           38400
  2672. #define CBR_56000           56000
  2673. #define CBR_57600           57600
  2674. #define CBR_115200          115200
  2675. #define CBR_128000          128000
  2676. #define CBR_256000          256000
  2677.  
  2678. //
  2679. // Error Flags
  2680. //
  2681.  
  2682. #define CE_RXOVER           0x0001  // Receive Queue overflow
  2683. #define CE_OVERRUN          0x0002  // Receive Overrun Error
  2684. #define CE_RXPARITY         0x0004  // Receive Parity Error
  2685. #define CE_FRAME            0x0008  // Receive Framing error
  2686. #define CE_BREAK            0x0010  // Break Detected
  2687. #define CE_TXFULL           0x0100  // TX Queue is full
  2688. #define CE_PTO              0x0200  // LPTx Timeout
  2689. #define CE_IOE              0x0400  // LPTx I/O Error
  2690. #define CE_DNS              0x0800  // LPTx Device not selected
  2691. #define CE_OOP              0x1000  // LPTx Out-Of-Paper
  2692. #define CE_MODE             0x8000  // Requested mode unsupported
  2693.  
  2694. #define IE_BADID            (-1)    // Invalid or unsupported id
  2695. #define IE_OPEN             (-2)    // Device Already Open
  2696. #define IE_NOPEN            (-3)    // Device Not Open
  2697. #define IE_MEMORY           (-4)    // Unable to allocate queues
  2698. #define IE_DEFAULT          (-5)    // Error in default parameters
  2699. #define IE_HARDWARE         (-10)   // Hardware Not Present
  2700. #define IE_BYTESIZE         (-11)   // Illegal Byte Size
  2701. #define IE_BAUDRATE         (-12)   // Unsupported BaudRate
  2702.  
  2703. //
  2704. // Events
  2705. //
  2706.  
  2707. #define EV_RXCHAR           0x0001  // Any Character received
  2708. #define EV_RXFLAG           0x0002  // Received certain character
  2709. #define EV_TXEMPTY          0x0004  // Transmitt Queue Empty
  2710. #define EV_CTS              0x0008  // CTS changed state
  2711. #define EV_DSR              0x0010  // DSR changed state
  2712. #define EV_RLSD             0x0020  // RLSD changed state
  2713. #define EV_BREAK            0x0040  // BREAK received
  2714. #define EV_ERR              0x0080  // Line status error occurred
  2715. #define EV_RING             0x0100  // Ring signal detected
  2716. #define EV_PERR             0x0200  // Printer error occured
  2717. #define EV_RX80FULL         0x0400  // Receive buffer is 80 percent full
  2718. #define EV_EVENT1           0x0800  // Provider specific event 1
  2719. #define EV_EVENT2           0x1000  // Provider specific event 2
  2720. #define EV_POWER            0x2000  // WINCE Power event.
  2721.  
  2722. //
  2723. // Escape Functions
  2724. //
  2725.  
  2726. #define SETXOFF             1       // Simulate XOFF received
  2727. #define SETXON              2       // Simulate XON received
  2728. #define SETRTS              3       // Set RTS high
  2729. #define CLRRTS              4       // Set RTS low
  2730. #define SETDTR              5       // Set DTR high
  2731. #define CLRDTR              6       // Set DTR low
  2732. // Gap for NT code RESETDEV, not supported on CE
  2733. #define SETBREAK            8       // Set the device break line.
  2734. #define CLRBREAK            9       // Clear the device break line.
  2735. #define SETIR               10      // Clear the device break line.
  2736. #define CLRIR               11      // Clear the device break line.
  2737.  
  2738. //
  2739. // PURGE function flags.
  2740. //
  2741. #define PURGE_TXABORT       0x0001  // Kill the pending/current writes to the comm port.
  2742. #define PURGE_RXABORT       0x0002  // Kill the pending/current reads to the comm port.
  2743. #define PURGE_TXCLEAR       0x0004  // Kill the transmit queue if there.
  2744. #define PURGE_RXCLEAR       0x0008  // Kill the typeahead buffer if there.
  2745.  
  2746. #define LPTx                0x80    // Set if ID is for LPT device
  2747.  
  2748. //
  2749. // Modem Status Flags
  2750. //
  2751. #define MS_CTS_ON           ((DWORD)0x0010)
  2752. #define MS_DSR_ON           ((DWORD)0x0020)
  2753. #define MS_RING_ON          ((DWORD)0x0040)
  2754. #define MS_RLSD_ON          ((DWORD)0x0080)
  2755.  
  2756. BOOL
  2757. WINAPI
  2758. ClearCommBreak(
  2759.     HANDLE hFile
  2760.     );
  2761.  
  2762.  
  2763. BOOL
  2764. WINAPI
  2765. ClearCommError(
  2766.     HANDLE hFile,
  2767.     LPDWORD lpErrors,
  2768.     LPCOMSTAT lpStat
  2769.     );
  2770.  
  2771.  
  2772. BOOL
  2773. WINAPI
  2774. SetupComm(
  2775.     HANDLE hFile,
  2776.     DWORD dwInQueue,
  2777.     DWORD dwOutQueue
  2778.     );
  2779.  
  2780.  
  2781. BOOL
  2782. WINAPI
  2783. EscapeCommFunction(
  2784.     HANDLE hFile,
  2785.     DWORD dwFunc
  2786.     );
  2787.  
  2788.  
  2789. BOOL
  2790. WINAPI
  2791. GetCommMask(
  2792.     HANDLE hFile,
  2793.     LPDWORD lpEvtMask
  2794.     );
  2795.  
  2796.  
  2797. BOOL
  2798. WINAPI
  2799. GetCommProperties(
  2800.     HANDLE hFile,
  2801.     LPCOMMPROP lpCommProp
  2802.     );
  2803.  
  2804.  
  2805. BOOL
  2806. WINAPI
  2807. GetCommModemStatus(
  2808.     HANDLE hFile,
  2809.     LPDWORD lpModemStat
  2810.     );
  2811.  
  2812.  
  2813. BOOL
  2814. WINAPI
  2815. GetCommState(
  2816.     HANDLE hFile,
  2817.     LPDCB lpDCB
  2818.     );
  2819.  
  2820.  
  2821. BOOL
  2822. WINAPI
  2823. GetCommTimeouts(
  2824.     HANDLE hFile,
  2825.     LPCOMMTIMEOUTS lpCommTimeouts
  2826.     );
  2827.  
  2828.  
  2829. BOOL
  2830. WINAPI
  2831. PurgeComm(
  2832.     HANDLE hFile,
  2833.     DWORD dwFlags
  2834.     );
  2835.  
  2836.  
  2837. BOOL
  2838. WINAPI
  2839. SetCommBreak(
  2840.     HANDLE hFile
  2841.     );
  2842.  
  2843.  
  2844. BOOL
  2845. WINAPI
  2846. SetCommMask(
  2847.     HANDLE hFile,
  2848.     DWORD dwEvtMask
  2849.     );
  2850.  
  2851.  
  2852. BOOL
  2853. WINAPI
  2854. SetCommState(
  2855.     HANDLE hFile,
  2856.     LPDCB lpDCB
  2857.     );
  2858.  
  2859.  
  2860. BOOL
  2861. WINAPI
  2862. SetCommTimeouts(
  2863.     HANDLE hFile,
  2864.     LPCOMMTIMEOUTS lpCommTimeouts
  2865.     );
  2866.  
  2867.  
  2868. BOOL
  2869. WINAPI
  2870. TransmitCommChar(
  2871.     HANDLE hFile,
  2872.     char cChar
  2873.     );
  2874.  
  2875.  
  2876. BOOL
  2877. WINAPI
  2878. WaitCommEvent(
  2879.     HANDLE hFile,
  2880.     LPDWORD lpEvtMask,
  2881.     LPOVERLAPPED lpOverlapped
  2882.     );
  2883.  
  2884. // End if IF COREDLL_SERDEV
  2885. // @CESYSGEN ENDIF
  2886.  
  2887. // @CESYSGEN IF GWES_GETPOWER
  2888. //
  2889. // Power Management APIs
  2890. //
  2891.  
  2892. #define AC_LINE_OFFLINE                 0x00
  2893. #define AC_LINE_ONLINE                  0x01
  2894. #define AC_LINE_BACKUP_POWER            0x02
  2895. #define AC_LINE_UNKNOWN                 0xFF
  2896.  
  2897. #define BATTERY_FLAG_HIGH               0x01
  2898. #define BATTERY_FLAG_LOW                0x02
  2899. #define BATTERY_FLAG_CRITICAL           0x04
  2900. #define BATTERY_FLAG_CHARGING           0x08
  2901. #define BATTERY_FLAG_NO_BATTERY         0x80
  2902. #define BATTERY_FLAG_UNKNOWN            0xFF
  2903.  
  2904. #define BATTERY_PERCENTAGE_UNKNOWN      0xFF
  2905.  
  2906. #define BATTERY_LIFE_UNKNOWN        0xFFFFFFFF
  2907.  
  2908. typedef struct _SYSTEM_POWER_STATUS_EX {
  2909.     BYTE ACLineStatus;
  2910.     BYTE BatteryFlag;
  2911.     BYTE BatteryLifePercent;
  2912.     BYTE Reserved1;
  2913.     DWORD BatteryLifeTime;
  2914.     DWORD BatteryFullLifeTime;
  2915.     BYTE Reserved2;
  2916.     BYTE BackupBatteryFlag;
  2917.     BYTE BackupBatteryLifePercent;
  2918.     BYTE Reserved3;
  2919.     DWORD BackupBatteryLifeTime;
  2920.     DWORD BackupBatteryFullLifeTime;
  2921. }   SYSTEM_POWER_STATUS_EX, *PSYSTEM_POWER_STATUS_EX, *LPSYSTEM_POWER_STATUS_EX;
  2922.  
  2923. BOOL
  2924. WINAPI
  2925. GetSystemPowerStatusEx(
  2926.     PSYSTEM_POWER_STATUS_EX pSystemPowerStatusEx,
  2927.     BOOL fUpdate
  2928.     );
  2929.  
  2930.  
  2931. void
  2932. WINAPI
  2933. BatteryNotifyOfTimeChange(
  2934.     BOOL fForward,
  2935.     FILETIME *pftDelta
  2936.     );
  2937. // @CESYSGEN ENDIF
  2938.  
  2939. // @CESYSGEN IF FILESYS_FSPASS
  2940. #ifdef _WIN32_WCE_EMULATION
  2941. BOOL WINAPI CheckPassword (LPWSTR lpszPassword);
  2942. #else
  2943. BOOL CheckPassword (LPWSTR lpszPassword);
  2944. #endif
  2945. // @CESYSGEN ENDIF
  2946.  
  2947. #ifdef _WIN32_WCE_EMULATION
  2948. HANDLE WINAPI RegisterDevice (LPCWSTR lpszName, DWORD index, LPCWSTR lpszLib, DWORD dwInfo);
  2949. BOOL   WINAPI DeregisterDevice (HANDLE hDevice);
  2950. BOOL   WINAPI LoadFSD (HANDLE hDevice, LPCWSTR lpFSDName);
  2951. #else
  2952. HANDLE RegisterDevice (LPCWSTR lpszName, DWORD index, LPCWSTR lpszLib, DWORD dwInfo);
  2953. BOOL DeregisterDevice (HANDLE hDevice);
  2954. BOOL LoadFSD (HANDLE hDevice, LPCWSTR lpFSDName);
  2955. #endif
  2956. HANDLE ActivateDevice(LPCWSTR lpszDevKey, DWORD dwClientInfo);
  2957. BOOL DeactivateDevice(HANDLE hDevice);
  2958.  
  2959. #include <winnls.h>
  2960.  
  2961. #ifdef __cplusplus
  2962. }
  2963. #endif
  2964.  
  2965. #ifdef WINCEOEM
  2966. #include <pwinbase.h>    // internal defines
  2967. #ifdef WINCEMACRO
  2968. #include <mwinbase.h>
  2969. #endif
  2970. #endif
  2971.  
  2972.  
  2973. #endif /* __WINBASE_H__ */
  2974.